Trait ReadWrite

Source
pub trait ReadWrite: Clone + Send {
    type Type;

    // Required methods
    fn n_bytes(&self) -> usize;
    fn read<R: Read>(&self, reader: &mut R) -> Result<Self::Type, Error>;
    fn write<W: Write>(
        &self,
        writer: &mut W,
        val: &Self::Type,
    ) -> Result<(), Error>;
}
Expand description

Trait used to read and write element of the associated type Type.

Required Associated Types§

Required Methods§

Source

fn n_bytes(&self) -> usize

Number of bytes redden or written

Source

fn read<R: Read>(&self, reader: &mut R) -> Result<Self::Type, Error>

Read an element of type Type from the given Reader

Source

fn write<W: Write>(&self, writer: &mut W, val: &Self::Type) -> Result<(), Error>

Write an element of type Type to the given Writer

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§