Skip to main content

DecoderInput

Trait DecoderInput 

Source
pub trait DecoderInput:
    Read
    + Seek
    + Send
    + Sync {
    // Provided method
    fn try_read(
        &mut self,
        buf: &mut [u8],
    ) -> Result<InputReadOutcome, StreamReadError> { ... }
}
Expand description

Combined trait for decoder input sources.

Supertrait combining Read + Seek + Send + Sync. Adds typed [try_read] returning InputReadOutcome so decoders never confuse “0 bytes” between EOF and Pending(...). kithara_stream::Stream packages its typed status (SeekPending, VariantChange, NotReady/Retry) into io::Error payloads via impl Read for Stream; the default try_read here downcasts those payloads back into PendingReason. Arbitrary Read + Seek sources (test cursors, fixtures) take the same default impl — raw io::Error becomes StreamReadError::Source, Ok(0)InputReadOutcome::Eof.

Provided Methods§

Source

fn try_read( &mut self, buf: &mut [u8], ) -> Result<InputReadOutcome, StreamReadError>

Typed read.

§Errors

Returns StreamReadError::Source for genuine source I/O failures. Status conditions (seek pending, variant change, data not ready) come back as Ok(InputReadOutcome::Pending(...)).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<T: Read + Seek + Send + Sync + ?Sized> DecoderInput for T