StreamEncoder

Struct StreamEncoder 

Source
pub struct StreamEncoder<W: Write> { /* private fields */ }
Expand description

A stream encoder that implements StreamDecodee. Using this, a ASN.1 stream can be written using a SAXParser style interface.

Implementations§

Source§

impl<W: Write> StreamEncoder<W>

Source

pub fn new<T: Into<ByteWriter<W>>>(writer: T) -> Self

Trait Implementations§

Source§

impl<W: Write> StreamDecodee for StreamEncoder<W>

Source§

fn start_element(&mut self, tag: Tag, len: Len) -> ParseResult

This function is called when an ASN.1 tag is encountered. In other words, at the start of an ASN.1 element.
Source§

fn end_element(&mut self, _: Tag, _: Len) -> ParseResult

This function is called when an ASN.1 element has finished decoding. Note that this is also called for all elements, even after a primitive() call. For this reason, you may need to check the constructed flag in some cases.
Source§

fn primitive<I: Iterator<Item = Result<u8>>>( &mut self, reader: &mut ByteReader<I>, len: LenNum, ) -> ParseResult

This function is called when a primitive element is encountered. Note that both start_element and end_element are called before/after this function.
Source§

fn warning(_: DecodeError) -> ParseResult

This function would be called when a recoverable decode error occurs, however currently nothing calls this.
Source§

fn error(_: DecodeError)

This function would be called when a fatal decoding error occurs, however currently nothing calls this.

Auto Trait Implementations§

§

impl<W> Freeze for StreamEncoder<W>
where W: Freeze,

§

impl<W> RefUnwindSafe for StreamEncoder<W>
where W: RefUnwindSafe,

§

impl<W> Send for StreamEncoder<W>
where W: Send,

§

impl<W> Sync for StreamEncoder<W>
where W: Sync,

§

impl<W> Unpin for StreamEncoder<W>
where W: Unpin,

§

impl<W> UnwindSafe for StreamEncoder<W>
where W: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.