Demonstrates using a Quent model from C++ via the CXX bridge. Uses the same model as the README example.
bridge/ CXX bridge crate with build.rs
gen/ Generated Rust FFI modules
include/ Generated C++ headers
cpp/
src/main.cpp C++ application exercising the model
Requires cmake, a C++ compiler, and Rust toolchain (via pixi or manually).
pixi shell
cd examples/cpp-integration/cpp
cmake -B build
cmake --build build./build/exampleThis produces an ndjson file in cpp/events/.
Each line is a JSON object with id, timestamp, and data fields.
The ndjson exporter in the above example writes one JSON object per line,
which is typically only useful for debugging and manual inspection. Production
deployments can use the MessagePack or Postcard exporters for lower overhead, or
stream to a centralized collector for distributed deployments, but to illustrate
the events stored, an example of the output is shown below:
{"id":"019d...","timestamp":1712345678000000000,"data":{"Task":{"Transition":{"seq":0,"state":{"Queued":{"name":"query-42","queue":{"resource_id":"01a2...","capacity":{"depth":1}}}}}}}}
{"id":"019d...","timestamp":1712345678000100000,"data":{"Task":{"Transition":{"seq":1,"state":{"Running":{"thread":{"resource_id":"01b3...","capacity":{}}}}}}}}
{"id":"019d...","timestamp":1712345678000200000,"data":{"Task":{"Transition":{"seq":2,"state":"Exit"}}}}