pub trait Serializable {
// Required methods
fn write<W: Write>(&self, w: &mut W) -> Result<()>;
fn read<R: Read>(r: &mut R) -> Result<Self>
where Self: Sized;
// Provided methods
fn read_bytes<R: Read, const N: usize>(r: &mut R) -> Result<[u8; N]> { ... }
fn read_u8<R: Read>(r: &mut R) -> Result<u8> { ... }
fn read_u16_le<R: Read>(r: &mut R) -> Result<u16> { ... }
fn read_u64_le<R: Read>(r: &mut R) -> Result<u64> { ... }
fn read_u32_le<R: Read>(r: &mut R) -> Result<u32> { ... }
fn write_var_le_bytes32<W: Write>(w: &mut W, buf: &[u8]) -> Result<()> { ... }
fn read_var_le_bytes32<R: Read>(r: &mut R) -> Result<Vec<u8>> { ... }
}Required Methods§
fn write<W: Write>(&self, w: &mut W) -> Result<()>
fn read<R: Read>(r: &mut R) -> Result<Self>where
Self: Sized,
Provided Methods§
fn read_bytes<R: Read, const N: usize>(r: &mut R) -> Result<[u8; N]>
fn read_u8<R: Read>(r: &mut R) -> Result<u8>
fn read_u16_le<R: Read>(r: &mut R) -> Result<u16>
fn read_u64_le<R: Read>(r: &mut R) -> Result<u64>
fn read_u32_le<R: Read>(r: &mut R) -> Result<u32>
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.