Function wrap_collector_fn

View as Markdown

Generated from cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-ffi.

pub fn wrap_collector_fn(
    cb: NemoRelayCollectorCb,
) -> Box<dyn FnMut(Value) -> Result<()> + Send>

Wrap a C collector callback into a Box<dyn FnMut(Json) -> Result<()> + Send> for use by the core runtime. Each intercepted chunk Json is serialized to a JSON string and passed to the callback.

Because the C collector callback signature returns void, the wrapper always returns Ok(()). C callers that need to signal errors from the collector should use a side-channel (e.g., setting a flag) and check it after the stream is consumed.

Safety

The caller must ensure cb remains valid for the lifetime of the returned closure. The C callback is invoked synchronously from the stream-consumption task.