pub struct VecInputBuffer { /* private fields */ }Expand description
An InputBuffer that read data from an internal buffer.
Implementations§
Source§impl VecInputBuffer
impl VecInputBuffer
Sourcepub fn read_object<T: FromBytes>(&mut self) -> Result<T, Errno>
pub fn read_object<T: FromBytes>(&mut self) -> Result<T, Errno>
Read an object from userspace memory and increment the read position.
Returns an error if there is not enough available bytes compared to the size of T.
Trait Implementations§
Source§impl Buffer for VecInputBuffer
impl Buffer for VecInputBuffer
Source§fn segments_count(&self) -> Result<usize, Errno>
fn segments_count(&self) -> Result<usize, Errno>
Returns the number of segments, if the buffer supports I/O directly
to/from individual segments.
Source§fn peek_each_segment(
&mut self,
callback: &mut PeekBufferSegmentsCallback<'_>,
) -> Result<(), Errno>
fn peek_each_segment( &mut self, callback: &mut PeekBufferSegmentsCallback<'_>, ) -> Result<(), Errno>
Calls the callback with each segment backing this buffer. Read more
Source§impl Debug for VecInputBuffer
impl Debug for VecInputBuffer
Source§impl InputBuffer for VecInputBuffer
impl InputBuffer for VecInputBuffer
Source§fn peek_each(
&mut self,
callback: &mut InputBufferCallback<'_>,
) -> Result<usize, Errno>
fn peek_each( &mut self, callback: &mut InputBufferCallback<'_>, ) -> Result<usize, Errno>
Calls
callback for each segment to peek data from. callback must returns the number of
bytes actually peeked. When it returns less than the size of the output buffer, the read
is stopped. Read moreSource§fn advance(&mut self, length: usize) -> Result<(), Errno>
fn advance(&mut self, length: usize) -> Result<(), Errno>
Consumes
length bytes of data from this buffer.Source§fn available(&self) -> usize
fn available(&self) -> usize
Returns the number of bytes available to be read from the buffer.
Source§fn bytes_read(&self) -> usize
fn bytes_read(&self) -> usize
Returns the number of bytes already read from the buffer.
Source§fn drain(&mut self) -> usize
fn drain(&mut self) -> usize
Clear the remaining content in the buffer. Returns the number of bytes swallowed. After this
method returns,
available() will returns 0. This does not touch the data in the buffer.Source§fn read_each(
&mut self,
callback: &mut InputBufferCallback<'_>,
) -> Result<usize, Errno>
fn read_each( &mut self, callback: &mut InputBufferCallback<'_>, ) -> Result<usize, Errno>
Calls
callback for each segment to read data from. callback must returns the number of
bytes actually read. When it returns less than the size of the output buffer, the read
is stopped. Read moreSource§fn read_all(&mut self) -> Result<Vec<u8>, Errno>
fn read_all(&mut self) -> Result<Vec<u8>, Errno>
Read all the remaining content in this buffer and returns it as a
Vec.Source§fn peek_all(&mut self) -> Result<Vec<u8>, Errno>
fn peek_all(&mut self) -> Result<Vec<u8>, Errno>
Peek all the remaining content in this buffer and returns it as a
Vec.Source§fn peek(&mut self, buffer: &mut [MaybeUninit<u8>]) -> Result<usize, Errno>
fn peek(&mut self, buffer: &mut [MaybeUninit<u8>]) -> Result<usize, Errno>
Peeks the content of this buffer into
buffer.
If buffer is too small, the read will be partial.
If buffer is too large, the remaining bytes will be left untouched. Read moreSource§fn read(&mut self, buffer: &mut [MaybeUninit<u8>]) -> Result<usize, Errno>
fn read(&mut self, buffer: &mut [MaybeUninit<u8>]) -> Result<usize, Errno>
Write the content of this buffer into
buffer.
If buffer is too small, the read will be partial.
If buffer is too large, the remaining bytes will be left untouched. Read moreSource§fn read_exact(&mut self, buffer: &mut [MaybeUninit<u8>]) -> Result<usize, Errno>
fn read_exact(&mut self, buffer: &mut [MaybeUninit<u8>]) -> Result<usize, Errno>
Read the exact number of bytes required to fill buf. Read more
Auto Trait Implementations§
impl Freeze for VecInputBuffer
impl RefUnwindSafe for VecInputBuffer
impl Send for VecInputBuffer
impl Sync for VecInputBuffer
impl Unpin for VecInputBuffer
impl UnwindSafe for VecInputBuffer
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
Mutably borrows from an owned value. Read more
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> InputBufferExt for Twhere
T: InputBuffer,
impl<T> InputBufferExt for Twhere
T: InputBuffer,
Source§fn read_to_vec_limited(&mut self, limit: usize) -> Result<Vec<u8>, Errno>
fn read_to_vec_limited(&mut self, limit: usize) -> Result<Vec<u8>, Errno>
Reads up to
limit bytes into a returned Vec.§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
Converts the given service transport handle of type
T to [Self]Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T, U> MultiArchFrom<T> for Uwhere
U: From<T>,
impl<T, U> MultiArchFrom<T> for Uwhere
U: From<T>,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T, U> TryIntoExt<U> for Twhere
U: TryFromExt<T>,
impl<T, U> TryIntoExt<U> for Twhere
U: TryFromExt<T>,
type Error = <U as TryFromExt<T>>::Error
§fn try_into_ext(self) -> Result<U, <T as TryIntoExt<U>>::Error>
fn try_into_ext(self) -> Result<U, <T as TryIntoExt<U>>::Error>
Tries to perform the conversion.