pub trait Encode: AsnType {
fn encode_with_tag<E: Encoder>(
&self,
encoder: &mut E,
tag: Tag
) -> Result<(), E::Error>;
fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), E::Error> { ... }
}
Expand description
A data type that can be encoded to a ASN.1 data format.
Required Methods
Encode this value with tag
into the given Encoder
.
Note For CHOICE
and other types that cannot be implicitly tagged
this will explicitly tag the value, for all other types, it will
implicitly tag the value.
Provided Methods
Encodes self
’s data into the given Encoder
.
Note for implementors You typically do not need to implement this.
The default implementation will call Encode::encode_with_tag
with
your types associated AsnType::TAG
. You should only ever need to
implement this if you have a type that cannot be implicitly tagged,
such as a CHOICE
type, in which case you want to implement encoding
in encode
.