| Crates.io | n-observer-cffi-impl |
| lib.rs | n-observer-cffi-impl |
| version | 0.1.0 |
| created_at | 2026-01-03 02:45:21.95928+00 |
| updated_at | 2026-01-03 02:45:21.95928+00 |
| description | CFFI logic without the C declarations for the n-observer rust library. |
| homepage | |
| repository | https://github.com/weirdev/n-observer |
| max_upload_size | |
| id | 2019499 |
| size | 40,483 |
Logic for CFFI types for the observer rust library.
Maintained as a separate crate so these can be shared as a rust library without exposing the CFFI bindings themselves.
pub struct CffiInnerObserverReceiver {
// ptr<&dyn InnerObserverReceiver>
pub self_ptr: *const c_void,
// self_ptr -> CffiPointerBuffer<opt_ptr<T>> -> CffiFuture<ptr<T>>
pub update_fut: extern "C" fn(*const c_void, CffiPointerBuffer) -> *const c_void,
// self_ptr -> ptr<&dyn Publisher> -> CffiFuture<ptr<T>>
// TODO: Second arg should be CffiPublisher
pub hold_strong_publisher_ref_fut: extern "C" fn(*const c_void, *const c_void) -> *const c_void,
}
pub struct CffiPublisher {
pub self_ptr: *const c_void,
// self_ptr -> CffiInnerObserverReceiver -> usize -> CffiFuture<ptr<opt_ptr<T>>>
pub add_observer_fut:
extern "C" fn(*const c_void, CffiInnerObserverReceiver, c_ulong) -> *const c_void,
// self_ptr -> ptr<T> -> CffiFuture<ptr<1>>
pub notify_fut: extern "C" fn(*const c_void, *const c_void) -> *const c_void,
}
The build script regenerates both the Rust and Python CFFI bindings. Run
cargo build -p observer_cffi_helpers from src/rust to refresh the generated
files (including src/py/centconf/observer_cffi/ior_cffi_traits.py).
For a quick equivalence check against the checked-in Python output without
manually diffing, execute scripts/compare_async_cffi_output.sh from the repo
root. The script snapshots the current file, rebuilds the bindings, and shows a
diff so you can confirm the regenerated output matches what is committed.