pub struct SliceReader<'de> { /* private fields */ }Expand description
An efficient Reader wrapper around a slice.
Implementations§
Source§impl<'de> SliceReader<'de>
impl<'de> SliceReader<'de>
Sourcepub fn new(slice: &'de [u8]) -> SliceReader<'de>
pub fn new(slice: &'de [u8]) -> SliceReader<'de>
Construct a new instance around the specified slice.
Trait Implementations§
Source§impl<'de> Reader<'de> for SliceReader<'de>
impl<'de> Reader<'de> for SliceReader<'de>
Source§type Error = SliceUnderflow
type Error = SliceUnderflow
Error type raised by the current reader.
Source§type Mut<'this> = &'this mut SliceReader<'de>
where
SliceReader<'de>: 'this
type Mut<'this> = &'this mut SliceReader<'de> where SliceReader<'de>: 'this
Type borrowed from self. Read more
Source§fn borrow_mut(&mut self) -> <SliceReader<'de> as Reader<'de>>::Mut<'_>
fn borrow_mut(&mut self) -> <SliceReader<'de> as Reader<'de>>::Mut<'_>
Borrow the current reader.
Source§fn skip<C>(&mut self, cx: &mut C, n: usize) -> Result<(), <C as Context>::Error>
fn skip<C>(&mut self, cx: &mut C, n: usize) -> Result<(), <C as Context>::Error>
Skip over the given number of bytes.
Source§fn read_bytes<C, V>(
&mut self,
cx: &mut C,
n: usize,
visitor: V,
) -> Result<<V as ValueVisitor<'de, C, [u8]>>::Ok, <C as Context>::Error>where
C: Context,
<C as Context>::Input: From<<SliceReader<'de> as Reader<'de>>::Error>,
V: ValueVisitor<'de, C, [u8]>,
fn read_bytes<C, V>(
&mut self,
cx: &mut C,
n: usize,
visitor: V,
) -> Result<<V as ValueVisitor<'de, C, [u8]>>::Ok, <C as Context>::Error>where
C: Context,
<C as Context>::Input: From<<SliceReader<'de> as Reader<'de>>::Error>,
V: ValueVisitor<'de, C, [u8]>,
Read a slice out of the current reader.
Source§fn peek<C>(&mut self, _: &mut C) -> Result<Option<u8>, <C as Context>::Error>
fn peek<C>(&mut self, _: &mut C) -> Result<Option<u8>, <C as Context>::Error>
Peek the next value.
Source§fn read<C>(
&mut self,
cx: &mut C,
buf: &mut [u8],
) -> Result<(), <C as Context>::Error>
fn read<C>( &mut self, cx: &mut C, buf: &mut [u8], ) -> Result<(), <C as Context>::Error>
Read a slice into the given buffer.
Source§fn read_byte<C>(&mut self, cx: &mut C) -> Result<u8, <C as Context>::Error>
fn read_byte<C>(&mut self, cx: &mut C) -> Result<u8, <C as Context>::Error>
Read a single byte.
Auto Trait Implementations§
impl<'de> Freeze for SliceReader<'de>
impl<'de> RefUnwindSafe for SliceReader<'de>
impl<'de> !Send for SliceReader<'de>
impl<'de> !Sync for SliceReader<'de>
impl<'de> Unpin for SliceReader<'de>
impl<'de> UnwindSafe for SliceReader<'de>
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