Trait InlinableRead

Source
pub trait InlinableRead: Read {
    // Provided methods
    fn read_len_with_width<const N: usize>(&mut self) -> Result<usize> { ... }
    fn read_f32(&mut self) -> Result<f32> { ... }
    fn read_f64(&mut self) -> Result<f64> { ... }
    fn read_u8(&mut self) -> Result<u8> { ... }
    fn read_u16(&mut self) -> Result<u16> { ... }
    fn read_u32(&mut self) -> Result<u32> { ... }
    fn read_u64(&mut self) -> Result<u64> { ... }
    fn read_u128(&mut self) -> Result<u128> { ... }
    fn read_len_with_data<const N: usize>(&mut self) -> Result<Vec<u8>> { ... }
    fn read_inlined_bytes<const N: usize>(&mut self) -> Result<Vec<u8>> { ... }
    fn read_inlined_str<const N: usize>(&mut self) -> Result<String> { ... }
    fn read_inlinable<T: Inlinable>(&mut self) -> Result<T>
       where Self: Sized { ... }
}

Provided Methods§

Source

fn read_len_with_width<const N: usize>(&mut self) -> Result<usize>

Read N bytes as usize.

Only 1/2/4/8 is valid as N.

Source

fn read_f32(&mut self) -> Result<f32>

Source

fn read_f64(&mut self) -> Result<f64>

Source

fn read_u8(&mut self) -> Result<u8>

Source

fn read_u16(&mut self) -> Result<u16>

Source

fn read_u32(&mut self) -> Result<u32>

Source

fn read_u64(&mut self) -> Result<u64>

Source

fn read_u128(&mut self) -> Result<u128>

Source

fn read_len_with_data<const N: usize>(&mut self) -> Result<Vec<u8>>

Read a bytes len with width N and the next len - N bytes into a Vec

The bytes contains:

+--------------+-----------------+
| len: N bytes | data: len - N bytes |
+--------------+-----------------+
Source

fn read_inlined_bytes<const N: usize>(&mut self) -> Result<Vec<u8>>

Read inlined bytes with specific length width N.

The inlined bytes are constructed as:

+--------------+-----------------+
| len: N bytes | data: len bytes |
+--------------+-----------------+
Source

fn read_inlined_str<const N: usize>(&mut self) -> Result<String>

Read inlined string with specific length width N.

The inlined string are constructed as:

+--------------+-----------------+
| len: N bytes | data: len bytes |
+--------------+-----------------+
Source

fn read_inlinable<T: Inlinable>(&mut self) -> Result<T>
where Self: Sized,

Read some bytes into inlinable object.

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§

Source§

impl<T> InlinableRead for T
where T: Read,