nim-ffi/examples/timer/README.md
Ivan FB ac303a707e
Start using CBOR (#23)
Co-authored-by: NagyZoltanPeter <113987313+NagyZoltanPeter@users.noreply.github.com>
Co-authored-by: Gabriel Cruz <8129788+gmelodie@users.noreply.github.com>
2026-05-16 01:08:42 +02:00

55 lines
963 B
Markdown

# timer example
This example is a self-contained Nimble project demonstrating how to import `nim-ffi` and use the `.ffiCtor.` / `.ffi.` abstraction.
## Usage
1. Change into the example directory:
```sh
cd examples/timer
```
2. Install the local `ffi` dependency:
```sh
nimble install -y ../..
```
3. Build the example library:
```sh
nimble build
```
4. Generate bindings:
```sh
nimble genbindings_rust
nimble genbindings_cpp
```
## Rust example clients
The Rust client lives in `examples/timer/rust_client`.
- Run the sync example:
```sh
cd examples/timer/rust_client
cargo run --bin rust_client
```
- Run the Tokio example:
```sh
cd examples/timer/rust_client
cargo run --bin tokio_client
```
## C++ example
The generated C++ example lives in `examples/timer/cpp_bindings`.
Build and run it with:
```sh
cd examples/timer/cpp_bindings
cmake -S . -B build
cmake --build build
./build/example
```