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> Decoder<'id, AudioGeneration> for SpeechDecoder
Available on crate feature audio only.
impl<'id> Decoder<'id, AudioGeneration> for SpeechDecoder
Available on crate feature
audio only.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>
Available on crate feature
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 rig_core::providers::cohere::embeddings::EmbeddingsDecoder
impl<'id> Decoder<'id, Embedding> for rig_core::providers::cohere::embeddings::EmbeddingsDecoder
Source§impl<'id> Decoder<'id, Embedding> for rig_core::providers::gemini::embedding::EmbeddingsDecoder
impl<'id> Decoder<'id, Embedding> for rig_core::providers::gemini::embedding::EmbeddingsDecoder
type Event = EmbeddingResponse
Source§impl<'id> Decoder<'id, Embedding> for rig_core::providers::ollama::embedding::EmbeddingsDecoder
impl<'id> Decoder<'id, Embedding> for rig_core::providers::ollama::embedding::EmbeddingsDecoder
type Event = EmbeddingResponse
Source§impl<'id> Decoder<'id, Embedding> for rig_core::providers::openai::wire::EmbeddingsDecoder
impl<'id> Decoder<'id, Embedding> for rig_core::providers::openai::wire::EmbeddingsDecoder
Source§impl<'id> Decoder<'id, Embedding> for rig_core::providers::voyageai::wire::EmbeddingsDecoder
impl<'id> Decoder<'id, Embedding> for rig_core::providers::voyageai::wire::EmbeddingsDecoder
type Event = EmbeddingResponse
Source§impl<'id> Decoder<'id, ImageEmbedding> for ImageEmbeddingsDecoder
impl<'id> Decoder<'id, ImageEmbedding> for ImageEmbeddingsDecoder
Source§impl<'id> Decoder<'id, ImageGeneration> for rig_core::providers::gemini::image_generation::ImagesDecoder
Available on crate feature image only.
impl<'id> Decoder<'id, ImageGeneration> for rig_core::providers::gemini::image_generation::ImagesDecoder
Available on crate feature
image only.Source§impl<'id> Decoder<'id, ImageGeneration> for rig_core::providers::openai::wire::ImagesDecoder
Available on crate feature image only.
impl<'id> Decoder<'id, ImageGeneration> for rig_core::providers::openai::wire::ImagesDecoder
Available on crate feature
image only.