fidius-host::client_stream
Rust
Host-side producer for client-streaming (FIDIUS-I-0030 / ADR-0007).
The inverse of the server-streaming StreamState: here the host produces
and the guest consumes. host_producer_handle builds a
FidiusStreamHandle from an iterator of bincode-encoded items; the guest’s
HostStream<T> pulls them by calling next. Reusing the same handle struct
keeps both stream directions on one ABI.
Functions
Section titled “Functions”fn host_producer_handle
Section titled “fn host_producer_handle”pub
fn host_producer_handle( items: impl Iterator<Item = Vec<u8>> + Send + 'static,) -> *mut FidiusStreamHandleBuild a FidiusStreamHandle the guest can pull, from an iterator of pre-encoded items (raw path). The returned handle is owned by the guest consumer, which frees it via drop_fn.
Source
pub fn host_producer_handle( items: impl Iterator<Item = Vec<u8>> + Send + 'static,) -> *mut FidiusStreamHandle { let mut items = items; build_handle(Box::new(move || items.next().map(Ok)))}fn host_producer_handle_typed
Section titled “fn host_producer_handle_typed”pub
fn host_producer_handle_typed<I: serde::Serialize + 'static>( items: impl Iterator<Item = I> + Send + 'static,) -> *mut FidiusStreamHandleLike host_producer_handle but takes a typed item iterator and bincode-encodes each item lazily — only when the guest pulls it (FIDIUS-T-0172). This is the path the typed PluginHandle::call_client_streaming / call_bidi_streaming use, so an unbounded input iterator flows with bounded host memory. An item that fails to encode surfaces as a serialization error to the guest call (no panic across the FFI).
Source
pub fn host_producer_handle_typed<I: serde::Serialize + 'static>( items: impl Iterator<Item = I> + Send + 'static,) -> *mut FidiusStreamHandle { let mut items = items; build_handle(Box::new(move || { items .next() .map(|i| fidius_core::wire::serialize(&i).map_err(|_| ())) }))}