pub struct Reader<'a> { /* private fields */ }Expand description
Reads values from the start of a slice, in a context, and keeps why one couldn’t be.
Implementations§
Source§impl<'a> Reader<'a>
impl<'a> Reader<'a>
pub fn new(bytes: &'a [u8]) -> Self
Sourcepub fn with_context(self, context: &'a mut (dyn Context + 'a)) -> Self
pub fn with_context(self, context: &'a mut (dyn Context + 'a)) -> Self
This reader, reading in context.
Sourcepub fn context_mut<T: Any>(&mut self) -> Option<&mut T>
pub fn context_mut<T: Any>(&mut self) -> Option<&mut T>
The context’s part of type T, to change, if it has one.
Sourcepub fn fail<T>(&mut self, message: &'static str) -> Option<T>
pub fn fail<T>(&mut self, message: &'static str) -> Option<T>
Records why a value can’t be read, and returns None for the read to
return.
pub fn byte(&mut self) -> Option<u8>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Reader<'a>
impl<'a> !Send for Reader<'a>
impl<'a> !Sync for Reader<'a>
impl<'a> !UnwindSafe for Reader<'a>
impl<'a> Forget for Reader<'a>
impl<'a> Freeze for Reader<'a>
impl<'a> Move for Reader<'a>
impl<'a> Unpin for Reader<'a>
impl<'a> UnsafeUnpin for Reader<'a>
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