pub trait Decode: Sized + AsnType {
// Required method
fn decode_with_tag_and_constraints<D: Decoder>(
decoder: &mut D,
tag: Tag,
constraints: Constraints<'_>
) -> Result<Self, D::Error>;
// Provided methods
fn decode<D: Decoder>(decoder: &mut D) -> Result<Self, D::Error> { ... }
fn decode_with_tag<D: Decoder>(
decoder: &mut D,
tag: Tag
) -> Result<Self, D::Error> { ... }
fn decode_with_constraints<D: Decoder>(
decoder: &mut D,
constraints: Constraints<'_>
) -> Result<Self, D::Error> { ... }
}
Expand description
A data type that can decoded from any ASN.1 format.
Required Methods§
fn decode_with_tag_and_constraints<D: Decoder>( decoder: &mut D, tag: Tag, constraints: Constraints<'_> ) -> Result<Self, D::Error>
Provided Methods§
sourcefn decode<D: Decoder>(decoder: &mut D) -> Result<Self, D::Error>
fn decode<D: Decoder>(decoder: &mut D) -> Result<Self, D::Error>
Decode this value from a given ASN.1 decoder.
Note for implementors You typically do not need to implement this.
The default implementation will call Decode::decode_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, which case you want to implement the decoding
in decode
.
sourcefn decode_with_tag<D: Decoder>(
decoder: &mut D,
tag: Tag
) -> Result<Self, D::Error>
fn decode_with_tag<D: Decoder>( decoder: &mut D, tag: Tag ) -> Result<Self, D::Error>
Decode this value implicitly tagged with tag
from a given ASN.1 decoder.
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.
fn decode_with_constraints<D: Decoder>( decoder: &mut D, constraints: Constraints<'_> ) -> Result<Self, D::Error>
Object Safety§
This trait is not object safe.