pub trait Decoder<'id, Op: Operation, Frame = WireFrame> {
type Event;
// Required methods
fn classify(&self, frame: Frame) -> WireEvent<Self::Event>;
fn decode(
&mut self,
event: Self::Event,
out: Out<'id, Op>,
) -> Result<Flow, ProviderError>;
// Provided method
fn eof(&mut self, out: Out<'id, Op>) -> Result<Flow, ProviderError> { ... }
}Expand description
Synchronous state machine for one reply. It classifies frames and
decodes known events into the reply’s writer, without transport access
and without being told how the reply arrives. HTTP wires read
WireFrames; other transports name their own frame type.
Required Associated Types§
Required Methods§
Sourcefn classify(&self, frame: Frame) -> WireEvent<Self::Event>
fn classify(&self, frame: Frame) -> WireEvent<Self::Event>
Decode and classify one frame. A JSON wire MUST delegate to a
classifier in crate::providers::internal::wire, so the
decode-then-validate policy is not re-derived per provider.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl<'id, Op: Operation, Event> Decoder<'id, Op> for DocumentDecoder<Op, Event>
impl<'id, Op: Operation, Event> Decoder<'id, Op> for DocumentDecoder<Op, Event>
Source§impl<'id> Decoder<'id, AudioGeneration> for rig_core::providers::gemini::audio_generation::SpeechDecoder
Available on crate feature audio only.
impl<'id> Decoder<'id, AudioGeneration> for rig_core::providers::gemini::audio_generation::SpeechDecoder
audio only.Source§impl<'id> Decoder<'id, AudioGeneration> for rig_core::providers::openai::wire::SpeechDecoder
Available on crate feature audio only.
impl<'id> Decoder<'id, AudioGeneration> for rig_core::providers::openai::wire::SpeechDecoder
audio only.Source§impl<'id> Decoder<'id, Completion, GenerateContentChunk> for GenerateContentDecoder
A transport that delivers each reply message as its REST chunk, such as
an SDK’s reply transcoded once, hands the decoder the chunk itself.
impl<'id> Decoder<'id, Completion, GenerateContentChunk> for GenerateContentDecoder
A transport that delivers each reply message as its REST chunk, such as an SDK’s reply transcoded once, hands the decoder the chunk itself.
type Event = GenerateContentChunk
Source§impl<'id> Decoder<'id, Completion, MockFrame> for MockDecoder<'id>
Available on crate feature test-utils only.
impl<'id> Decoder<'id, Completion, MockFrame> for MockDecoder<'id>
test-utils only.Source§impl<'id> Decoder<'id, Completion> for rig_core::providers::cohere::streaming::ChatDecoder
impl<'id> Decoder<'id, Completion> for rig_core::providers::cohere::streaming::ChatDecoder
Source§impl<'id> Decoder<'id, Completion> for rig_core::providers::ollama::streaming::ChatDecoder
impl<'id> Decoder<'id, Completion> for rig_core::providers::ollama::streaming::ChatDecoder
type Event = ChatRecord
Source§impl<'id> Decoder<'id, Completion> for CohereDecoder
impl<'id> Decoder<'id, Completion> for CohereDecoder
type Event = CohereEvent
Source§impl<'id> Decoder<'id, Completion> for GenerateContentDecoder
impl<'id> Decoder<'id, Completion> for GenerateContentDecoder
type Event = GenerateContentChunk
Source§impl<'id> Decoder<'id, Completion> for InteractionsDecoder
EOF without interaction.completed is truncation, not successful
completion, so the decoder has nothing to add at the end of the reply.
impl<'id> Decoder<'id, Completion> for InteractionsDecoder
EOF without interaction.completed is truncation, not successful
completion, so the decoder has nothing to add at the end of the reply.
type Event = InteractionsEvent
Source§impl<'id> Decoder<'id, Completion> for MessagesDecoder
impl<'id> Decoder<'id, Completion> for MessagesDecoder
type Event = MessagesEvent
Source§impl<'id> Decoder<'id, Completion> for OpenAiDecoder
impl<'id> Decoder<'id, Completion> for OpenAiDecoder
type Event = OpenAiEvent
Source§impl<'id> Decoder<'id, Completion> for ResponsesDecoder
impl<'id> Decoder<'id, Completion> for ResponsesDecoder
type Event = ResponsesEvent
Source§impl<'id> Decoder<'id, ContextCache> for CachedContentsDecoder
impl<'id> Decoder<'id, ContextCache> for CachedContentsDecoder
type Event = CachedContentReply
Source§impl<'id> Decoder<'id, Embedding> for EmbeddingsDecoder
impl<'id> Decoder<'id, Embedding> for EmbeddingsDecoder
Source§impl<'id> Decoder<'id, ImageGeneration> for ImagesDecoder
Available on crate feature image only.
impl<'id> Decoder<'id, ImageGeneration> for ImagesDecoder
image only.type Event = ImagesEvent
Source§impl<'id> Decoder<'id, VoiceCloning> for VoiceClonesDecoder
Available on crate feature audio only.
impl<'id> Decoder<'id, VoiceCloning> for VoiceClonesDecoder
audio only.