AsnType

Trait AsnType 

Source
pub trait AsnType {
    const TAG: Tag;
    const TAG_TREE: TagTree = _;
    const CONSTRAINTS: Constraints = Constraints::NONE;
    const IDENTIFIER: Identifier = Identifier::EMPTY;
    const IS_CHOICE: bool = false;

    // Provided method
    fn is_present(&self) -> bool { ... }
}
Expand description

A trait representing any type that can represented in ASN.1.

Required Associated Constants§

Source

const TAG: Tag

The associated tag for the type.

Note When implementing CHOICE types, this should be set to Tag::EOC and instead set the Self::TAG_TREE constant to contain all variants.

Provided Associated Constants§

Source

const TAG_TREE: TagTree = _

The root of this type’s tree of tag’s if it a CHOICE type, otherwise its Leaf that points Self::TAG.

Source

const CONSTRAINTS: Constraints = Constraints::NONE

The set of constraints for values of the given type.

Source

const IDENTIFIER: Identifier = Identifier::EMPTY

Identifier of an ASN.1 type as specified in the original specification if not identical with the identifier of Self

Source

const IS_CHOICE: bool = false

Whether the type is choice type. PER/OER encoding rules require this knowledge.

Provided Methods§

Source

fn is_present(&self) -> bool

Whether the type is present with value. OPTIONAL fields are common in SEQUENCE or SET.

Custom implementation is only used for OPTIONAL type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl AsnType for &str

Source§

const TAG: Tag = Tag::UTF8_STRING

Source§

const IDENTIFIER: Identifier = Identifier::UTF8_STRING

Source§

impl AsnType for bool

Source§

const TAG: Tag = Tag::BOOL

Source§

const IDENTIFIER: Identifier = Identifier::BOOL

Source§

impl AsnType for f32

Available on crate feature f32 only.
Source§

const TAG: Tag = Tag::REAL

Source§

const IDENTIFIER: Identifier = Identifier::REAL

Source§

impl AsnType for f64

Available on crate feature f64 only.
Source§

const TAG: Tag = Tag::REAL

Source§

const IDENTIFIER: Identifier = Identifier::REAL

Source§

impl AsnType for i8

Source§

const TAG: Tag = Tag::INTEGER

Source§

const IDENTIFIER: Identifier = Identifier::INTEGER

Source§

const CONSTRAINTS: Constraints

Source§

impl AsnType for i16

Source§

const TAG: Tag = Tag::INTEGER

Source§

const IDENTIFIER: Identifier = Identifier::INTEGER

Source§

const CONSTRAINTS: Constraints

Source§

impl AsnType for i32

Source§

const TAG: Tag = Tag::INTEGER

Source§

const IDENTIFIER: Identifier = Identifier::INTEGER

Source§

const CONSTRAINTS: Constraints

Source§

impl AsnType for i64

Source§

const TAG: Tag = Tag::INTEGER

Source§

const IDENTIFIER: Identifier = Identifier::INTEGER

Source§

const CONSTRAINTS: Constraints

Source§

impl AsnType for i128

Source§

const TAG: Tag = Tag::INTEGER

Source§

const IDENTIFIER: Identifier = Identifier::INTEGER

Source§

const CONSTRAINTS: Constraints

Source§

impl AsnType for isize

Source§

const TAG: Tag = Tag::INTEGER

Source§

const IDENTIFIER: Identifier = Identifier::INTEGER

Source§

const CONSTRAINTS: Constraints

Source§

impl AsnType for str

Source§

const TAG: Tag = Tag::UTF8_STRING

Source§

const IDENTIFIER: Identifier = Identifier::UTF8_STRING

Source§

impl AsnType for u8

Source§

const TAG: Tag = Tag::INTEGER

Source§

const IDENTIFIER: Identifier = Identifier::INTEGER

Source§

const CONSTRAINTS: Constraints

Source§

impl AsnType for u16

Source§

const TAG: Tag = Tag::INTEGER

Source§

const IDENTIFIER: Identifier = Identifier::INTEGER

Source§

const CONSTRAINTS: Constraints

Source§

impl AsnType for u32

Source§

const TAG: Tag = Tag::INTEGER

Source§

const IDENTIFIER: Identifier = Identifier::INTEGER

Source§

const CONSTRAINTS: Constraints

Source§

impl AsnType for u64

Source§

const TAG: Tag = Tag::INTEGER

Source§

const IDENTIFIER: Identifier = Identifier::INTEGER

Source§

const CONSTRAINTS: Constraints

Source§

impl AsnType for u128

Source§

const TAG: Tag = Tag::INTEGER

Source§

const IDENTIFIER: Identifier = Identifier::INTEGER

Source§

const CONSTRAINTS: Constraints

Source§

impl AsnType for ()

Source§

const TAG: Tag = Tag::NULL

Source§

const IDENTIFIER: Identifier = Identifier::NULL

Source§

impl AsnType for usize

Source§

const TAG: Tag = Tag::INTEGER

Source§

const IDENTIFIER: Identifier = Identifier::INTEGER

Source§

const CONSTRAINTS: Constraints

Source§

impl AsnType for BigInt

Source§

const TAG: Tag = Tag::INTEGER

Source§

const IDENTIFIER: Identifier = Identifier::INTEGER

Source§

impl<'a, T: 'a + ToOwned + AsnType> AsnType for Cow<'a, T>

Source§

const TAG: Tag = T::TAG

Source§

const TAG_TREE: TagTree = T::TAG_TREE

Source§

const IDENTIFIER: Identifier = T::IDENTIFIER

Source§

impl<T> AsnType for &[T]

Source§

const TAG: Tag = Tag::SEQUENCE

Source§

const IDENTIFIER: Identifier = Identifier::SEQUENCE_OF

Source§

impl<T> AsnType for PhantomData<T>

Source§

const TAG: Tag = Tag::NULL

Source§

const TAG_TREE: TagTree

Source§

impl<T: AsnType> AsnType for Option<T>

Source§

const TAG: Tag = T::TAG

Source§

const TAG_TREE: TagTree = T::TAG_TREE

Source§

const IDENTIFIER: Identifier = T::IDENTIFIER

Source§

fn is_present(&self) -> bool

Source§

impl<T: AsnType> AsnType for &T

Source§

const TAG: Tag = T::TAG

Source§

const TAG_TREE: TagTree = T::TAG_TREE

Source§

const IDENTIFIER: Identifier = T::IDENTIFIER

Source§

fn is_present(&self) -> bool

Source§

impl<T: AsnType> AsnType for Box<T>

Source§

const TAG: Tag = T::TAG

Source§

const TAG_TREE: TagTree = T::TAG_TREE

Source§

const IDENTIFIER: Identifier = T::IDENTIFIER

Source§

impl<T: AsnType> AsnType for Vec<T>

Source§

const TAG: Tag = Tag::SEQUENCE

Source§

const IDENTIFIER: Identifier = Identifier::SEQUENCE_OF

Source§

impl<T: AsnType, const N: usize> AsnType for [T; N]

Source§

const TAG: Tag = Tag::SEQUENCE

Source§

const CONSTRAINTS: Constraints

Source§

const IDENTIFIER: Identifier = Identifier::SEQUENCE_OF

Implementors§

Source§

impl AsnType for Open

Source§

const TAG: Tag = { crate::types::Tag::EOC }

Source§

const TAG_TREE: TagTree

Source§

const IDENTIFIER: Identifier

Source§

const IS_CHOICE: bool = true

Source§

impl AsnType for Any

Source§

const TAG: Tag = Tag::EOC

Source§

const TAG_TREE: TagTree

Source§

impl AsnType for BmpString

Source§

const TAG: Tag = Tag::BMP_STRING

Source§

const IDENTIFIER: Identifier = Identifier::BMP_STRING

Source§

impl AsnType for GeneralString

Source§

const TAG: Tag = Tag::GENERAL_STRING

Source§

const IDENTIFIER: Identifier = Identifier::GENERAL_STRING

Source§

impl AsnType for GraphicString

Source§

const TAG: Tag = Tag::GRAPHIC_STRING

Source§

const IDENTIFIER: Identifier = Identifier::GRAPHIC_STRING

Source§

impl AsnType for Ia5String

Source§

const TAG: Tag = Tag::IA5_STRING

Source§

const IDENTIFIER: Identifier = Identifier::IA5_STRING

Source§

impl AsnType for Integer

Source§

const TAG: Tag = Tag::INTEGER

Source§

const IDENTIFIER: Identifier = Identifier::INTEGER

Source§

impl AsnType for NumericString

Source§

const TAG: Tag = Tag::NUMERIC_STRING

Source§

const IDENTIFIER: Identifier = Identifier::NUMERIC_STRING

Source§

impl AsnType for ObjectIdentifier

Source§

const TAG: Tag = Tag::OBJECT_IDENTIFIER

Source§

const IDENTIFIER: Identifier = Identifier::OBJECT_IDENTIFIER

Source§

impl AsnType for OctetString

Source§

const TAG: Tag = Tag::OCTET_STRING

Source§

const IDENTIFIER: Identifier = Identifier::OCTET_STRING

Source§

impl AsnType for Oid

Source§

const TAG: Tag = Tag::OBJECT_IDENTIFIER

Source§

const IDENTIFIER: Identifier = Identifier::OBJECT_IDENTIFIER

Source§

impl AsnType for PrintableString

Source§

const TAG: Tag = Tag::PRINTABLE_STRING

Source§

const IDENTIFIER: Identifier = Identifier::PRINTABLE_STRING

Source§

impl AsnType for TeletexString

Source§

const TAG: Tag = Tag::TELETEX_STRING

Source§

const IDENTIFIER: Identifier = Identifier::TELETEX_STRING

Source§

impl AsnType for Utf8String

Source§

const TAG: Tag = Tag::UTF8_STRING

Source§

const IDENTIFIER: Identifier = Identifier::UTF8_STRING

Source§

impl AsnType for VisibleString

Source§

const TAG: Tag = Tag::VISIBLE_STRING

Source§

const IDENTIFIER: Identifier = Identifier::VISIBLE_STRING

Source§

impl AsnType for BitStr

Source§

const TAG: Tag = Tag::BIT_STRING

Source§

const IDENTIFIER: Identifier = Identifier::BIT_STRING

Source§

impl AsnType for BitString

Source§

const TAG: Tag = Tag::BIT_STRING

Source§

const IDENTIFIER: Identifier = Identifier::BIT_STRING

Source§

impl AsnType for Date

Source§

const TAG: Tag = Tag::DATE

Source§

const IDENTIFIER: Identifier = Identifier::DATE

Source§

impl AsnType for GeneralizedTime

Source§

const TAG: Tag = Tag::GENERALIZED_TIME

Source§

const IDENTIFIER: Identifier = Identifier::GENERALIZED_TIME

Source§

impl AsnType for UtcTime

Source§

const TAG: Tag = Tag::UTC_TIME

Source§

const IDENTIFIER: Identifier = Identifier::UTC_TIME

Source§

impl<T> AsnType for InstanceOf<T>

Source§

const TAG: Tag = Tag::EXTERNAL

Source§

const IDENTIFIER: Identifier = Identifier::INSTANCE_OF

Source§

impl<T> AsnType for SetOf<T>

Source§

const TAG: Tag = Tag::SET

Source§

const IDENTIFIER: Identifier = Identifier::SET_OF

Source§

impl<T: AsnType, V> AsnType for Explicit<T, V>

Source§

const TAG: Tag = T::TAG

Source§

impl<T: AsnType, V> AsnType for Implicit<T, V>

Source§

const TAG: Tag = T::TAG

Source§

impl<const N: usize> AsnType for FixedOctetString<N>

Source§

const TAG: Tag = Tag::OCTET_STRING

Source§

const CONSTRAINTS: Constraints

Source§

const IDENTIFIER: Identifier = Identifier::OCTET_STRING

Source§

impl<const N: usize> AsnType for FixedBitString<N>

Source§

const TAG: Tag = Tag::BIT_STRING

Source§

const CONSTRAINTS: Constraints

Source§

const IDENTIFIER: Identifier = Identifier::BIT_STRING

Source§

impl<const START: i128, const END: i128> AsnType for ConstrainedInteger<START, END>

Source§

const TAG: Tag = Tag::INTEGER

Source§

const CONSTRAINTS: Constraints