mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-08-25 07:01:08 +00:00
feat: implement Client crate and C FFI bindings (#73)
Implement a `client` crate that wraps the `libchat` context behind a simple `ChatClient<D>` API. The delivery strategy is pluggable via a `DeliveryService` trait, with two implementations provided: - `InProcessDelivery` — shared `MessageBus` for single-process tests - `CDelivery` — C function-pointer callback for the FFI layer Add a `client-ffi` crate that exposes the client as a C API via `safer-ffi`. A `generate-headers` binary produces the companion C header. Include two runnable examples: - `examples/in-process` — Alice/Bob exchange using in-process delivery - `examples/c-ffi` — same exchange written entirely in C; smoketested under valgrind (to catch memory leaks) in CI iterates: #71
This commit is contained in:
@@ -36,3 +36,21 @@ jobs:
|
||||
- run: rustup update stable && rustup default stable
|
||||
- run: rustup component add rustfmt
|
||||
- run: cargo fmt --all -- --check
|
||||
|
||||
c-ffi-smoketest:
|
||||
name: C FFI Smoketest
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: rustup update stable && rustup default stable
|
||||
- name: Install valgrind
|
||||
run: sudo apt-get install -y valgrind
|
||||
- name: Build C FFI example
|
||||
run: make
|
||||
working-directory: crates/client-ffi/examples/message-exchange
|
||||
- name: Run C FFI smoketest
|
||||
run: ./c-client
|
||||
working-directory: crates/client-ffi/examples/message-exchange
|
||||
- name: Run C FFI smoketest under valgrind
|
||||
run: make valgrind
|
||||
working-directory: crates/client-ffi/examples/message-exchange
|
||||
|
||||
Reference in New Issue
Block a user