Struct der::Encoder[][src]

pub struct Encoder<'a> { /* fields omitted */ }

DER encoder.

Implementations

impl<'a> Encoder<'a>[src]

pub fn new(bytes: &'a mut [u8]) -> Self[src]

Create a new encoder with the given byte slice as a backing buffer.

pub fn encode<T: Encodable>(&mut self, encodable: &T) -> Result<()>[src]

Encode a value which impls the Encodable trait.

pub fn error<T>(&mut self, kind: ErrorKind) -> Result<T>[src]

Return an error with the given ErrorKind, annotating it with context about where the error occurred.

pub fn is_failed(&self) -> bool[src]

Did the decoding operation fail due to an error?

pub fn finish(self) -> Result<&'a [u8]>[src]

Finish encoding to the buffer, returning a slice containing the data written to the buffer.

pub fn bit_string(&mut self, value: impl TryInto<BitString<'a>>) -> Result<()>[src]

Encode the provided value as an ASN.1 BIT STRING

pub fn generalized_time(
    &mut self,
    value: impl TryInto<GeneralizedTime>
) -> Result<()>
[src]

Encode the provided value as an ASN.1 GeneralizedTime

pub fn ia5_string(&mut self, value: impl TryInto<Ia5String<'a>>) -> Result<()>[src]

Encode the provided value as an ASN.1 IA5String

pub fn null(&mut self) -> Result<()>[src]

Encode an ASN.1 NULL value.

pub fn octet_string(
    &mut self,
    value: impl TryInto<OctetString<'a>>
) -> Result<()>
[src]

Encode the provided value as an ASN.1 OCTET STRING

pub fn oid(&mut self, oid: impl TryInto<ObjectIdentifier>) -> Result<()>[src]

This is supported on crate feature oid only.

Encode an ASN.1 ObjectIdentifier

pub fn printable_string(
    &mut self,
    value: impl TryInto<PrintableString<'a>>
) -> Result<()>
[src]

Encode the provided value as an ASN.1 PrintableString

pub fn utc_time(&mut self, value: impl TryInto<UtcTime>) -> Result<()>[src]

Encode the provided value as an ASN.1 UTCTime

pub fn utf8_string(&mut self, value: impl TryInto<Utf8String<'a>>) -> Result<()>[src]

Encode the provided value as an ASN.1 Utf8String

pub fn sequence(&mut self, encodables: &[&dyn Encodable]) -> Result<()>[src]

Encode a sequence of values which impl the Encodable trait.

pub fn reserve(&mut self, len: impl TryInto<Length>) -> Result<&mut [u8]>[src]

Reserve a portion of the internal buffer, updating the internal cursor position and returning a mutable slice.

Trait Implementations

impl<'a> Debug for Encoder<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Encoder<'a>

impl<'a> Send for Encoder<'a>

impl<'a> Sync for Encoder<'a>

impl<'a> Unpin for Encoder<'a>

impl<'a> !UnwindSafe for Encoder<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.