#testing #pact #cdc #mockserver


Pact matching interface for foreign languages. [DEPRECATED, replaced with pact_ffi]

5 releases

0.0.5 Jul 11, 2021
0.0.4 Jun 23, 2021
0.0.3 May 30, 2021
0.0.2 May 30, 2021
0.0.1 May 4, 2021

#3 in #c-int

Download history 13/week @ 2023-10-29 6/week @ 2023-11-05 8/week @ 2023-11-12 8/week @ 2023-11-19 16/week @ 2023-11-26 18/week @ 2023-12-03 4/week @ 2023-12-10 9/week @ 2023-12-17 19/week @ 2023-12-24 2/week @ 2023-12-31 6/week @ 2024-01-07 4/week @ 2024-01-14 8/week @ 2024-01-21 12/week @ 2024-01-28 6/week @ 2024-02-04 30/week @ 2024-02-11

56 downloads per month
Used in pact_mock_server_ffi

MIT license

1.5K SLoC

Pact Matching FFI [DEPRECATED]

NOTE: This library is being moved into a single FFI library pact_ffi.

This crate provides a Foreign Function Interface (FFI) to the pact_matching crate, with the intent of enabling Pact's core matching mechanisms to be used by implementations in other languages.


This crates requires:

  • cbindgen, a tool for automatically generating the header file needed for C users of the crate.
  • A nightly-channel version of Cargo (needed for an unstable flag used by cbindgen to get the macro-expanded contents of the crate source).

It will additionally attempt to find and use Doxygen to generate C-friendly documentation (you can of course alternatively use cargo doc to get Rustdoc documentation).

Note: Linking to the generated static library on Linux requires you to also link to pthread, dl and m.


For convenience, this tool integrates with CMake, which is setup to:

  1. Run Cargo to build the library file.
  2. Run Cbindgen to build the header file.
  3. Run Doxygen to build the documentation.

To use this CMake build, you can do the following:

$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .

You can also optionally install the built artifacts as follows:

$ cmake --install . --prefix=<install location (omit to install globally)>


This project also includes example uses which depend on the crate via CMake.

Before building an example, make sure to run the following from the overall CMake build directory (./build):

$ cmake --install . --prefix ./install

Then, from the example's directory, do the following:

$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .


You can read about the architecture and design choices of this crate in ARCHITECTURE.md.


~737K SLoC