Skip to main content

StreamHandler

Trait StreamHandler 

Source
pub trait StreamHandler: Send + Sync {
    // Required method
    fn on_token(&self, token: String);
}
Expand description

Token-by-token callback for streaming on React Native.

Implement on the TS/Kotlin/Swift side and pass to EdgeLlm::ask_stream_cb. Each call delivers one text fragment; the method returns (and calls nothing more) when generation is complete.

Dart bindings use the edge_llm_ask_stream FRB wrapper and StreamSink<String> instead.

Required Methods§

Source

fn on_token(&self, token: String)

Trait Implementations§

Source§

impl<UT> LiftRef<UT> for Box<dyn StreamHandler>

Source§

impl<UT> LiftReturn<UT> for Box<dyn StreamHandler>

Source§

type ReturnType = <Box<dyn StreamHandler> as Lift<UT>>::FfiType

FFI return type for trait interfaces
Source§

fn try_lift_successful_return(v: Self::ReturnType) -> Result<Self>

Lift a successfully returned value from a trait interface
Source§

fn lift_foreign_return( ffi_return: Self::ReturnType, call_status: RustCallStatus, ) -> Self

Lift a foreign returned value from a trait interface Read more
Source§

fn lift_error(_buf: RustBuffer) -> Self

Lift a Rust value for a callback interface method error result Read more
Source§

fn handle_callback_unexpected_error(e: UnexpectedUniFFICallbackError) -> Self

Lift a Rust value for an unexpected callback interface error Read more

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§