pub trait BinarySource<'de>: Sized {
type Mark;
// Required methods
fn mark(&mut self) -> Result<Self::Mark>;
fn restore(&mut self, mark: &Self::Mark) -> Result<()>;
fn skip(&mut self) -> Result<()>;
fn peek(&mut self) -> Result<u8>;
fn readbytes(&mut self, count: usize) -> Result<Cow<'de, [u8]>>;
fn readbytes_into(&mut self, bs: &mut [u8]) -> Result<()>;
// Provided methods
fn packed<N: NestedValue, Dec: DomainDecode<N::Embedded>>(
&mut self,
decode_embedded: Dec,
) -> PackedReader<'de, '_, N, Dec, Self> { ... }
fn packed_iovalues(
&mut self,
) -> PackedReader<'de, '_, IOValue, IOValueDomainCodec, Self> { ... }
fn text<N: NestedValue, Dec: DomainParse<N::Embedded>>(
&mut self,
decode_embedded: Dec,
) -> TextReader<'de, '_, N, Dec, Self> { ... }
fn text_iovalues(
&mut self,
) -> TextReader<'de, '_, IOValue, ViaCodec<IOValueDomainCodec>, Self> { ... }
}Expand description
Generic seekable stream of input bytes.
Required Associated Types§
Required Methods§
Sourcefn mark(&mut self) -> Result<Self::Mark>
fn mark(&mut self) -> Result<Self::Mark>
Retrieve a marker for the current position in the input.
Sourcefn restore(&mut self, mark: &Self::Mark) -> Result<()>
fn restore(&mut self, mark: &Self::Mark) -> Result<()>
Seek the input to a previously-saved position.
Sourcefn readbytes(&mut self, count: usize) -> Result<Cow<'de, [u8]>>
fn readbytes(&mut self, count: usize) -> Result<Cow<'de, [u8]>>
Returns and consumes the next count bytes, which must all be available. Always yields
exactly count bytes or an error.
Sourcefn readbytes_into(&mut self, bs: &mut [u8]) -> Result<()>
fn readbytes_into(&mut self, bs: &mut [u8]) -> Result<()>
As BinarySource::readbytes, but uses bs as destination for the read bytes as well
as taking the size of bs as the count of bytes to read.
Provided Methods§
Sourcefn packed<N: NestedValue, Dec: DomainDecode<N::Embedded>>(
&mut self,
decode_embedded: Dec,
) -> PackedReader<'de, '_, N, Dec, Self>
fn packed<N: NestedValue, Dec: DomainDecode<N::Embedded>>( &mut self, decode_embedded: Dec, ) -> PackedReader<'de, '_, N, Dec, Self>
Constructs a PackedReader that will read from self.
Sourcefn packed_iovalues(
&mut self,
) -> PackedReader<'de, '_, IOValue, IOValueDomainCodec, Self>
fn packed_iovalues( &mut self, ) -> PackedReader<'de, '_, IOValue, IOValueDomainCodec, Self>
Constructs a PackedReader that will read IOValues from self.
Sourcefn text<N: NestedValue, Dec: DomainParse<N::Embedded>>(
&mut self,
decode_embedded: Dec,
) -> TextReader<'de, '_, N, Dec, Self>
fn text<N: NestedValue, Dec: DomainParse<N::Embedded>>( &mut self, decode_embedded: Dec, ) -> TextReader<'de, '_, N, Dec, Self>
Constructs a TextReader that will read from self.
Sourcefn text_iovalues(
&mut self,
) -> TextReader<'de, '_, IOValue, ViaCodec<IOValueDomainCodec>, Self>
fn text_iovalues( &mut self, ) -> TextReader<'de, '_, IOValue, ViaCodec<IOValueDomainCodec>, Self>
Constructs a TextReader that will read IOValues from self.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".