Struct der::SliceReader 
source · 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(bytes: &'a [u8]) -> Result<Self>
 
pub fn new(bytes: &'a [u8]) -> Result<Self>
Create a new slice reader for the given byte slice.
sourcepub fn error(&mut self, kind: ErrorKind) -> Error
 
pub fn error(&mut self, kind: ErrorKind) -> Error
Return an error with the given ErrorKind, annotating it with
context about where the error occurred.
sourcepub fn value_error(&mut self, tag: Tag) -> Error
 
pub fn value_error(&mut self, tag: Tag) -> Error
Return an error for an invalid value with the given tag.
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 copy of the value. Read more
1.0.0§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 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_header(&self) -> Result<Header>
 
fn peek_header(&self) -> Result<Header>
source§fn read_slice(&mut self, len: Length) -> Result<&'a [u8]>
 
fn read_slice(&mut self, len: Length) -> Result<&'a [u8]>
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<T>(self, value: T) -> Result<T>
 
fn finish<T>(self, value: T) -> Result<T>
Finish decoding, returning the given value if there is no
remaining data, or an error otherwise
source§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>>where
    T: DecodeValue<'r> + FixedTag,
 
fn context_specific<T>(
    &mut self,
    tag_number: TagNumber,
    tag_mode: TagMode,
) -> Result<Option<T>>where
    T: DecodeValue<'r> + FixedTag,
Attempt to decode an ASN.1 
CONTEXT-SPECIFIC field with the
provided TagNumber.source§fn is_finished(&self) -> bool
 
fn is_finished(&self) -> bool
Have we read all of the input data?
source§fn read_into<'o>(&mut self, buf: &'o mut [u8]) -> Result<&'o [u8]>
 
fn read_into<'o>(&mut self, buf: &'o mut [u8]) -> Result<&'o [u8]>
Attempt to read input data, writing it into the provided buffer, and
returning a slice on success. Read more
source§fn read_nested<'n, T, F>(&'n mut self, len: Length, f: F) -> Result<T>where
    F: FnOnce(&mut NestedReader<'n, Self>) -> Result<T>,
 
fn read_nested<'n, T, F>(&'n mut self, len: Length, f: F) -> Result<T>where
    F: FnOnce(&mut NestedReader<'n, Self>) -> Result<T>,
Read nested data of the given length.
source§fn read_vec(&mut self, len: Length) -> Result<Vec<u8>>
 
fn read_vec(&mut self, len: Length) -> Result<Vec<u8>>
Read a byte vector of the given length.
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> UnwindSafe for SliceReader<'a>
Blanket Implementations§
§impl<T> Any for Twhere
    T: 'static + ?Sized,
 
impl<T> Any for Twhere
    T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
    T: ?Sized,
 
impl<T> Borrow<T> for Twhere
    T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
§unsafe fn clone_to_uninit(&self, dst: *mut T)
 
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)