> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/relay/llms.txt.
> For full documentation content, see https://docs.nvidia.com/nemo/relay/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/relay/_mcp/server.

# Function wrap_collector_fn

> 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.

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

<pre />

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.