Skip to main content

Reassemble

Trait Reassemble 

Source
pub trait Reassemble<Event>:
    Default
    + WasmCompatSend
    + 'static {
    // Required methods
    fn absorb(&mut self, event: &Event);
    fn finish(self) -> Value;
}
Expand description

Rebuilds one reply’s provider document from its decoder’s events.

A fresh value per reply. absorb sees every known event of the reply, in arrival order, before the decoder decodes it; unknown and corrupt frames never reach it. finish runs once, when the reply ends, fails or is cut short; a reply that did not end yields the document so far.

Required Methods§

Source

fn absorb(&mut self, event: &Event)

Absorb one known event of the reply.

Source

fn finish(self) -> Value

The document the absorbed events add up to. Null records none.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl Reassemble<GenerateContentChunk> for GenerateContentResponse

Each chunk in REST JSON; the document is Null when there were none.

Source§

impl Reassemble<InteractionsEvent> for Interaction

Source§

impl Reassemble<MessagesEvent> for Message

Source§

impl Reassemble<MockFrame> for MockDocument

Available on crate feature test-utils only.
Source§

impl Reassemble<OpenAiEvent> for OpenAiReassembler

Source§

impl<Event> Reassemble<Event> for Unreassembled