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>
impl<'a, S: BitmapSlice + Default> Reader<'a, S>
sourcepub fn from_fuse_buffer(buf: FuseBuf<'a>) -> Result<Reader<'a, S>>
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>
impl<S: BitmapSlice> Reader<'_, S>
sourcepub fn read_obj<T: ByteValued>(&mut self) -> Result<T>
pub fn read_obj<T: ByteValued>(&mut self) -> Result<T>
Reads an object from the descriptor chain buffer.
sourcepub fn read_to<F: FileReadWriteVolatile>(
&mut self,
dst: F,
count: usize,
) -> Result<usize>
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.
sourcepub fn read_to_at<F: FileReadWriteVolatile>(
&mut self,
dst: F,
count: usize,
off: u64,
) -> Result<usize>
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.
sourcepub fn read_exact_to<F: FileReadWriteVolatile>(
&mut self,
dst: F,
count: usize,
) -> Result<()>
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.
sourcepub fn available_bytes(&self) -> usize
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.
sourcepub fn bytes_read(&self) -> usize
pub fn bytes_read(&self) -> usize
Returns number of bytes already read from the descriptor chain buffer.
sourcepub fn split_at(&mut self, offset: usize) -> Result<Self>
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<S: BitmapSlice> Default for Reader<'_, S>
impl<S: BitmapSlice> Default for Reader<'_, S>
source§impl<S: BitmapSlice> Read for Reader<'_, S>
impl<S: BitmapSlice> Read for Reader<'_, S>
source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
1.36.0 · source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
read
, except that it reads into a slice of buffers. Read moresource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector
)1.0.0 · source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
buf
. Read more1.0.0 · source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
buf
. Read more1.6.0 · source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
buf
. Read moresource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
read_buf
)source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
read_buf
)cursor
. Read more1.0.0 · source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Read
. Read moreAuto 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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)