pub struct SliceReader<'a> { /* private fields */ }Expand description
Reader which consumes an input byte slice.
Implementations§
Source§impl<'a> SliceReader<'a>
impl<'a> SliceReader<'a>
Sourcepub fn new_with_encoding_rules(
bytes: &'a [u8],
encoding_rules: EncodingRules,
) -> Result<Self, Error>
pub fn new_with_encoding_rules( bytes: &'a [u8], encoding_rules: EncodingRules, ) -> Result<Self, Error>
Trait Implementations§
Source§impl<'a> Clone for SliceReader<'a>
impl<'a> Clone for SliceReader<'a>
Source§fn clone(&self) -> SliceReader<'a>
fn clone(&self) -> SliceReader<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for SliceReader<'a>
impl<'a> Debug for SliceReader<'a>
Source§impl<'a> Reader<'a> for SliceReader<'a>
impl<'a> Reader<'a> for SliceReader<'a>
Source§fn read_nested<T, F, E>(&mut self, len: Length, f: F) -> Result<T, E>
fn read_nested<T, F, E>(&mut self, len: Length, f: F) -> Result<T, E>
Read nested data of the given length.
Source§const CAN_READ_SLICE: bool = true
const CAN_READ_SLICE: bool = true
Does this reader support the
read_slice method? (i.e. can it borrow from his input?)Source§fn encoding_rules(&self) -> EncodingRules
fn encoding_rules(&self) -> EncodingRules
Get the
EncodingRules which should be applied when decoding the input.Source§fn read_slice(&mut self, len: Length) -> Result<&'a [u8], Error>
fn read_slice(&mut self, len: Length) -> Result<&'a [u8], Error>
Attempt to read data borrowed directly from the input as a slice,
updating the internal cursor position. Read more
Source§fn error(&mut self, kind: ErrorKind) -> Error
fn error(&mut self, kind: ErrorKind) -> Error
Return an error with the given
ErrorKind, annotating it with
context about where the error occurred.Source§fn finish(self) -> Result<(), Error>
fn finish(self) -> Result<(), Error>
Finish decoding, returning
Ok(()) if there is no
remaining data, or an error otherwise. Read moreSource§fn remaining_len(&self) -> Length
fn remaining_len(&self) -> Length
Get the number of bytes still remaining in the buffer.
Source§fn context_specific<T>(
&mut self,
tag_number: TagNumber,
tag_mode: TagMode,
) -> Result<Option<T>, T::Error>where
T: DecodeValue<'r> + FixedTag + 'r,
fn context_specific<T>(
&mut self,
tag_number: TagNumber,
tag_mode: TagMode,
) -> Result<Option<T>, T::Error>where
T: DecodeValue<'r> + FixedTag + 'r,
Source§fn drain(&mut self, amount: Length) -> Result<(), Error>
fn drain(&mut self, amount: Length) -> Result<(), Error>
Drain the given amount of data from the reader, discarding it. Read more
Source§fn is_finished(&self) -> bool
fn is_finished(&self) -> bool
Have we read all input data?
Source§fn peek_byte(&self) -> Option<u8>
fn peek_byte(&self) -> Option<u8>
Peek at the next byte of input without modifying the cursor.
Source§fn peek_into(&self, buf: &mut [u8]) -> Result<(), Error>
fn peek_into(&self, buf: &mut [u8]) -> Result<(), Error>
Peek at the decoded data without updating the internal state, writing into the provided
output buffer. Attempts to fill the entire buffer. Read more
Source§fn peek_header(&self) -> Result<Header, Error>
fn peek_header(&self) -> Result<Header, Error>
👎Deprecated since 0.8.0:
use Header::peek instead
Source§fn peek_tag(&self) -> Result<Tag, Error>
fn peek_tag(&self) -> Result<Tag, Error>
👎Deprecated since 0.8.0:
use Tag::peek instead
Peek at the next tag in the reader. Read more
Source§fn read_into<'o>(&mut self, buf: &'o mut [u8]) -> Result<&'o [u8], Error>
fn read_into<'o>(&mut self, buf: &'o mut [u8]) -> Result<&'o [u8], Error>
Attempt to read input data, writing it into the provided buffer, and
returning a slice on success. Read more
Source§fn read_vec(&mut self, len: Length) -> Result<Vec<u8>, Error>
fn read_vec(&mut self, len: Length) -> Result<Vec<u8>, Error>
Read a byte vector of the given length. Read more
Auto Trait Implementations§
impl<'a> Freeze for SliceReader<'a>
impl<'a> RefUnwindSafe for SliceReader<'a>
impl<'a> Send for SliceReader<'a>
impl<'a> Sync for SliceReader<'a>
impl<'a> Unpin for SliceReader<'a>
impl<'a> UnsafeUnpin for SliceReader<'a>
impl<'a> UnwindSafe for SliceReader<'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