pub struct PemReader<'i> { /* private fields */ }Expand description
Reader type which decodes PEM on-the-fly.
Implementations§
Source§impl<'i> PemReader<'i>
impl<'i> PemReader<'i>
Sourcepub fn new(pem: &'i [u8]) -> Result<Self>
pub fn new(pem: &'i [u8]) -> Result<Self>
Create a new PEM reader which decodes data on-the-fly.
Uses the default 64-character line wrapping.
§Errors
If a decoding error occurred.
Sourcepub fn type_label(&self) -> &'i str
pub fn type_label(&self) -> &'i str
Get the PEM label which will be used in the encapsulation boundaries for this document.
Trait Implementations§
Source§impl<'i> Reader<'static> for PemReader<'i>
impl<'i> Reader<'static> for PemReader<'i>
Source§const CAN_READ_SLICE: bool = false
const CAN_READ_SLICE: bool = false
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_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. Read more
Source§fn read_slice(&mut self, _len: Length) -> Result<&'static [u8]>
fn read_slice(&mut self, _len: Length) -> Result<&'static [u8]>
Attempt to read data borrowed directly from the input as a slice,
updating the internal cursor position. Read more
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 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 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 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_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
Source§fn remaining_len(&self) -> Length
fn remaining_len(&self) -> Length
Get the number of bytes still remaining in the buffer.
Auto Trait Implementations§
impl<'i> Freeze for PemReader<'i>
impl<'i> RefUnwindSafe for PemReader<'i>
impl<'i> Send for PemReader<'i>
impl<'i> Sync for PemReader<'i>
impl<'i> Unpin for PemReader<'i>
impl<'i> UnsafeUnpin for PemReader<'i>
impl<'i> UnwindSafe for PemReader<'i>
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