Struct fuse_backend_rs::transport::Reader

source ·
pub struct Reader<'a, S = ()> { /* private fields */ }
Expand description

Reader to access FUSE requests from the transport layer data buffers.

Note that virtio spec requires driver to place any device-writable descriptors after any device-readable descriptors (2.6.4.2 in Virtio Spec v1.1). Reader will skip iterating over descriptor chain when first writable descriptor is encountered.

Implementations§

source§

impl<'a, S: BitmapSlice + Default> Reader<'a, S>

source

pub fn from_fuse_buffer(buf: FuseBuf<'a>) -> Result<Reader<'a, S>>

Construct a new Reader wrapper over desc_chain.

’request`: Fuse request from clients read from /dev/fuse

source§

impl<S: BitmapSlice> Reader<'_, S>

source

pub fn read_obj<T: ByteValued>(&mut self) -> Result<T>

Reads an object from the descriptor chain buffer.

source

pub fn read_to<F: FileReadWriteVolatile>( &mut self, dst: F, count: usize ) -> Result<usize>

Reads data from the descriptor chain buffer into a file descriptor. Returns the number of bytes read from the descriptor chain buffer. The number of bytes read can be less than count if there isn’t enough data in the descriptor chain buffer.

source

pub fn read_to_at<F: FileReadWriteVolatile>( &mut self, dst: F, count: usize, off: u64 ) -> Result<usize>

Reads data from the descriptor chain buffer into a File at offset off. Returns the number of bytes read from the descriptor chain buffer. The number of bytes read can be less than count if there isn’t enough data in the descriptor chain buffer.

source

pub fn read_exact_to<F: FileReadWriteVolatile>( &mut self, dst: F, count: usize ) -> Result<()>

Reads exactly size of data from the descriptor chain buffer into a file descriptor.

source

pub fn available_bytes(&self) -> usize

Returns number of bytes available for reading.

May return an error if the combined lengths of all the buffers in the DescriptorChain would cause an integer overflow.

source

pub fn bytes_read(&self) -> usize

Returns number of bytes already read from the descriptor chain buffer.

source

pub fn split_at(&mut self, offset: usize) -> Result<Self>

Splits this Reader into two at the given offset in the DescriptorChain buffer. After the split, self will be able to read up to offset bytes while the returned Reader can read up to available_bytes() - offset bytes. Returns an error if offset > self.available_bytes().

Trait Implementations§

source§

impl<'a, S: Clone> Clone for Reader<'a, S>

source§

fn clone(&self) -> Reader<'a, S>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<S: BitmapSlice> Default for Reader<'_, S>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<S: BitmapSlice> Read for Reader<'_, S>

source§

fn read(&mut self, buf: &mut [u8]) -> Result<usize>

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
1.36.0 · source§

fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>

Like read, except that it reads into a slice of buffers. Read more
source§

fn is_read_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Reader has an efficient read_vectored implementation. Read more
1.0.0 · source§

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>

Read all bytes until EOF in this source, placing them into buf. Read more
1.0.0 · source§

fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>

Read all bytes until EOF in this source, appending them to buf. Read more
1.6.0 · source§

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

Read the exact number of bytes required to fill buf. Read more
source§

fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Pull some bytes from this source into the specified buffer. Read more
source§

fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Read the exact number of bytes required to fill cursor. Read more
1.0.0 · source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adaptor for this instance of Read. Read more
1.0.0 · source§

fn bytes(self) -> Bytes<Self>
where Self: Sized,

Transforms this Read instance to an Iterator over its bytes. Read more
1.0.0 · source§

fn chain<R>(self, next: R) -> Chain<Self, R>
where R: Read, Self: Sized,

Creates an adapter which will chain this stream with another. Read more
1.0.0 · source§

fn take(self, limit: u64) -> Take<Self>
where Self: Sized,

Creates an adapter which will read at most limit bytes from it. Read more

Auto Trait Implementations§

§

impl<'a, S> Freeze for Reader<'a, S>

§

impl<'a, S> RefUnwindSafe for Reader<'a, S>
where S: RefUnwindSafe,

§

impl<'a, S = ()> !Send for Reader<'a, S>

§

impl<'a, S = ()> !Sync for Reader<'a, S>

§

impl<'a, S> Unpin for Reader<'a, S>
where S: Unpin,

§

impl<'a, S> UnwindSafe for Reader<'a, S>
where S: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.