pub struct Private<T> {
pub tag_number: TagNumber,
pub tag_mode: TagMode,
pub value: T,
}Expand description
PRIVATE field which wraps an owned inner value.
This type decodes/encodes a field which is specific to a particular context
and is identified by a TagNumber.
Fields§
§tag_number: TagNumberPRIVATE tag number sans the leading 0b11000000 class
identifier bit and 0b100000 constructed flag.
tag_mode: TagModeTag mode: EXPLICIT VS IMPLICIT.
value: TValue of the field.
Implementations§
Source§impl<T> Private<T>
impl<T> Private<T>
Sourcepub fn decode_explicit<'a, R: Reader<'a>>(
reader: &mut R,
tag_number: TagNumber,
) -> Result<Option<Self>, T::Error>where
T: Decode<'a>,
pub fn decode_explicit<'a, R: Reader<'a>>(
reader: &mut R,
tag_number: TagNumber,
) -> Result<Option<Self>, T::Error>where
T: Decode<'a>,
Attempt to decode an EXPLICIT ASN.1 PRIVATE field with the
provided TagNumber.
This method has the following behavior which decodes tag numbers one by one
in extension fields, which are denoted in an ASN.1 schema using
the ... ellipsis extension marker:
- Returns
Ok(Some(..))if tag number matches. - Returns
Ok(None)if class other thanClass::Privatetag is encountered. - Returns
Ok(None)if a field with a different tag number is encountered. These fields are not consumed in this case.
§Errors
Returns ErrorKind::Noncanonical if constructed bit is primitive.
Sourcepub fn decode_implicit<'a, R: Reader<'a>>(
reader: &mut R,
tag_number: TagNumber,
) -> Result<Option<Self>, T::Error>where
T: DecodeValue<'a> + IsConstructed,
pub fn decode_implicit<'a, R: Reader<'a>>(
reader: &mut R,
tag_number: TagNumber,
) -> Result<Option<Self>, T::Error>where
T: DecodeValue<'a> + IsConstructed,
Attempt to decode an IMPLICIT ASN.1 PRIVATE field with the
provided TagNumber.
This method otherwise behaves the same as decode_explicit,
but should be used in cases where the particular fields are IMPLICIT
as opposed to EXPLICIT.
Differences from EXPLICIT:
- Returns
ErrorKind::Noncanonicalif constructed bit does not match constructed bit of the base encoding.
§Errors
Returns T::Error in the event of a decoding error.