pub struct CaptureSource<'a, S: 'a> { /* private fields */ }Expand description
A source that captures what has been advanced over.
A capture source wraps a mutable reference to some other source and provides the usual source access. However, instead of dropping octets that have been advanced over, it keeps them around and allows taking them out as a bytes value.
This type is used by Constructed::capture.
Implementations§
Source§impl<'a, S: Source> CaptureSource<'a, S>
impl<'a, S: Source> CaptureSource<'a, S>
Trait Implementations§
Source§impl<'a, S: Source + 'a> Source for CaptureSource<'a, S>
impl<'a, S: Source + 'a> Source for CaptureSource<'a, S>
Source§type Error = <S as Source>::Error
type Error = <S as Source>::Error
The error produced when the source failed to read more data.
Source§fn request(&mut self, len: usize) -> Result<usize, Self::Error>
fn request(&mut self, len: usize) -> Result<usize, Self::Error>
Request at least
len bytes to be available. Read moreSource§fn bytes(&self, start: usize, end: usize) -> Bytes
fn bytes(&self, start: usize, end: usize) -> Bytes
Produces a
Bytes value from part of the data. Read moreSource§fn skip(&mut self, len: usize) -> Result<usize, Self::Error>
fn skip(&mut self, len: usize) -> Result<usize, Self::Error>
Skip over the next
len bytes. Read moreSource§fn take_u8(&mut self) -> Result<u8, DecodeError<Self::Error>>
fn take_u8(&mut self) -> Result<u8, DecodeError<Self::Error>>
Takes a single octet from the source. Read more
Source§fn take_opt_u8(&mut self) -> Result<Option<u8>, Self::Error>
fn take_opt_u8(&mut self) -> Result<Option<u8>, Self::Error>
Takes an optional octet from the source. Read more
Source§fn content_err(&self, err: impl Into<ContentError>) -> DecodeError<Self::Error>
fn content_err(&self, err: impl Into<ContentError>) -> DecodeError<Self::Error>
Returns a content error at the current position of the source.
Auto Trait Implementations§
impl<'a, S> Freeze for CaptureSource<'a, S>
impl<'a, S> RefUnwindSafe for CaptureSource<'a, S>where
S: RefUnwindSafe,
impl<'a, S> Send for CaptureSource<'a, S>where
S: Send,
impl<'a, S> Sync for CaptureSource<'a, S>where
S: Sync,
impl<'a, S> Unpin for CaptureSource<'a, S>
impl<'a, S> !UnwindSafe for CaptureSource<'a, S>
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