Trait bcder::encode::Values

source ·
pub trait Values {
    fn encoded_len(&self, mode: Mode) -> usize;
    fn write_encoded<W: Write>(
        &self,
        mode: Mode,
        target: &mut W
    ) -> Result<(), Error>; fn explicit(self, tag: Tag) -> Constructed<Self>
    where
        Self: Sized
, { ... } fn to_captured(&self, mode: Mode) -> Captured { ... } }
Expand description

A type that is a value encoder.

Value encoders know how to encode themselves into a sequence of BER encoded values. While you can impl this trait for your type manually, in practice it is often easier to define a method called encode and let it return some dedicated value encoder type constructed from the types provided by this module.

A type implementing this trait should encodes itself into one or more BER values. That is, the type becomes the content or part of the content of a constructed value.

Required Methods§

Returns the length of the encoded values for the given mode.

Encodes the values in the given mode and writes them to target.

Provided Methods§

Converts the encoder into one with an explicit tag.

Captures the encoded values in the given mode.

Implementations on Foreign Types§

Encoding of an optional value.

This implementation encodes None as nothing, i.e., as an OPTIONAL in ASN.1 parlance.

Implementors§