Skip to main content

VariableReadable

Trait VariableReadable 

Source
pub trait VariableReadable {
    type Error;

    // Required method
    fn read_single(&mut self) -> Result<u8, Self::Error>;

    // Provided methods
    fn read_more(&mut self, buf: &mut [u8]) -> Result<(), Self::Error> { ... }
    fn read_more_buf<B: BufMut>(
        &mut self,
        buf: &mut B,
    ) -> Result<(), Self::Error> { ... }
}
Available on crate feature sync only.

Required Associated Types§

Required Methods§

Source

fn read_single(&mut self) -> Result<u8, Self::Error>

Provided Methods§

Source

fn read_more(&mut self, buf: &mut [u8]) -> Result<(), Self::Error>

Source

fn read_more_buf<B: BufMut>(&mut self, buf: &mut B) -> Result<(), Self::Error>

Available on crate feature bytes only.

You may call [bytes::BytesMut::limit] to prevent reading more data than needed.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<R: Read> VariableReadable for R

Available on crate feature std-comp only.