fuse

Trait RequestReader

Source
pub trait RequestReader: Read {
    // Required methods
    fn read_until(&mut self, byte: u8) -> Result<Vec<u8>>;
    fn remaining_len(&self) -> usize;

    // Provided methods
    fn read_count(&mut self, count: usize) -> Result<Box<[u8]>> { ... }
    fn read_all(&mut self) -> Result<Box<[u8]>> { ... }
    fn read_type<T: IntoBytes + FromBytes + Immutable + KnownLayout>(
        &mut self,
    ) -> Result<T> { ... }
    fn string(&mut self) -> Result<LxString> { ... }
    fn name(&mut self) -> Result<LxString> { ... }
}
Expand description

Helpers to parse FUSE messages.

Required Methods§

Source

fn read_until(&mut self, byte: u8) -> Result<Vec<u8>>

Read until a matching byte is found.

This should advance the read position beyond the matching byte, and return the data up to (but not including) the matching byte.

This is used to read NULL-terminated strings.

Source

fn remaining_len(&self) -> usize

Gets the remaining, unread length of the input data.

Provided Methods§

Source

fn read_count(&mut self, count: usize) -> Result<Box<[u8]>>

Consume the next count bytes.

Source

fn read_all(&mut self) -> Result<Box<[u8]>>

Read all the remaining data.

Source

fn read_type<T: IntoBytes + FromBytes + Immutable + KnownLayout>( &mut self, ) -> Result<T>

Read a struct of type T.

Source

fn string(&mut self) -> Result<LxString>

Read a NULL-terminated string

Source

fn name(&mut self) -> Result<LxString>

Read a NULL-terminated string and ensure it’s a valid path name component.

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.

Implementations on Foreign Types§

Source§

impl RequestReader for &[u8]

Source§

fn read_until(&mut self, byte: u8) -> Result<Vec<u8>>

Source§

fn remaining_len(&self) -> usize

Implementors§