pub struct StreamDecoder { /* private fields */ }Expand description
Incremental HTTP SSE decoder. Feed bytes until decode returns None,
then provide the next chunk. Drain pending deltas even with empty input.
Errors fuse the decoder; successful terminals ignore unread wire tails.
Implementations§
Source§impl StreamDecoder
impl StreamDecoder
Sourcepub fn new(
protocol: Protocol,
limits: StreamLimits,
) -> Result<Self, ModelInvokeError>
pub fn new( protocol: Protocol, limits: StreamLimits, ) -> Result<Self, ModelInvokeError>
Creates a decoder for a supported protocol with explicit resource limits.
Sourcepub fn decode(
&mut self,
input: &mut &[u8],
) -> Result<Option<StreamDelta>, ModelInvokeError>
pub fn decode( &mut self, input: &mut &[u8], ) -> Result<Option<StreamDelta>, ModelInvokeError>
Consumes a prefix until one delta is ready or input is exhausted. Call again with the remaining slice; a terminal leaves its tail unread.
Sourcepub fn finish(&mut self) -> Result<(), ModelInvokeError>
pub fn finish(&mut self) -> Result<(), ModelInvokeError>
Ends input explicitly. Malformed framing/encoding is undecodable; a valid stream prefix without a provider terminal is unknown outcome.
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Whether an authoritative provider terminal has been accepted.
Auto Trait Implementations§
impl Freeze for StreamDecoder
impl RefUnwindSafe for StreamDecoder
impl Send for StreamDecoder
impl Sync for StreamDecoder
impl Unpin for StreamDecoder
impl UnsafeUnpin for StreamDecoder
impl UnwindSafe for StreamDecoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more