Struct bsn1::Id [−][src]
pub struct Id { /* fields omitted */ }Expand description
Id owns IdRef and represents Identifier.
Implementations
Creates a new instance from class , pc , and number .
Warnings
ASN.1 reserves some universal identifier numbers and they should not be used, however, this function ignores that. For example, number 15 (0x0f) is reserved so far, but this function accepts such a number.
Examples
use bsn1::{ClassTag, Id, PCTag};
// Creates 'Universal Integer'
let _id = Id::new(ClassTag::Universal, PCTag::Primitive, 2);Methods from Deref<Target = IdRef>
Returns ClassTag of self .
Examples
use bsn1::{ClassTag, Id, PCTag};
// 'Id' implements 'Deref<Target = IdRef>'.
let id = Id::new(ClassTag::Universal, PCTag::Primitive, 0);
assert_eq!(ClassTag::Universal, id.class());
let id = Id::new(ClassTag::Application, PCTag::Constructed, 1);
assert_eq!(ClassTag::Application, id.class());
let id = Id::new(ClassTag::ContextSpecific, PCTag::Primitive, 2);
assert_eq!(ClassTag::ContextSpecific, id.class());
let id = Id::new(ClassTag::Private, PCTag::Constructed, 3);
assert_eq!(ClassTag::Private, id.class());Returns true if self is ‘Universal’ class, or false .
Examples
use bsn1::{ClassTag, Id, PCTag};
// 'Id' implements 'Deref<Target = IdRef>'.
let id = Id::new(ClassTag::Universal, PCTag::Primitive, 0);
assert_eq!(true, id.is_universal());Returns true if self is ‘Application’ class, or false .
Examples
use bsn1::{ClassTag, Id, PCTag};
// 'Id' implements 'Deref<Target = IdRef>'.
let id = Id::new(ClassTag::Application, PCTag::Primitive, 0);
assert_eq!(true, id.is_application());Returns true if self is ‘Context Specific’ class, or false .
Examples
use bsn1::{ClassTag, Id, PCTag};
// 'Id' implements 'Deref<Target = IdRef>'.
let id = Id::new(ClassTag::ContextSpecific, PCTag::Primitive, 0);
assert_eq!(true, id.is_context_specific());Returns true if self is ‘Private’ class, or false .
Examples
use bsn1::{ClassTag, Id, PCTag};
// 'Id' implements 'Deref<Target = IdRef>'.
let id = Id::new(ClassTag::Private, PCTag::Primitive, 0);
assert_eq!(true, id.is_private());Returns the Primitive/Constructed flag of self .
Examples
use bsn1::{ClassTag, Id, PCTag};
// 'Id' implements 'Deref<Target = IdRef>'.
let id = Id::new(ClassTag::Universal, PCTag::Primitive, 0);
assert_eq!(PCTag::Primitive, id.pc());
let id = Id::new(ClassTag::Application, PCTag::Constructed, 1);
assert_eq!(PCTag::Constructed, id.pc());Returns true if self is flagged as ‘Primitive’, or false .
Examples
use bsn1::{ClassTag, Id, PCTag};
// 'Id' implements 'Deref<Target = IdRef>'.
let id = Id::new(ClassTag::Universal, PCTag::Primitive, 0);
assert_eq!(true, id.is_primitive());Returns true if self is flagged as ‘Constructed’, or false .
Examples
use bsn1::{ClassTag, Id, PCTag};
// 'Id' implements 'Deref<Target = IdRef>'.
let id = Id::new(ClassTag::Universal, PCTag::Constructed, 0);
assert_eq!(true, id.is_constructed());Trait Implementations
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
Parses bytes starts with identifier octets and tries to build a new instance.
This function ignores the extra octet(s) at the end if any.
Warnings
ASN.1 reserves some universal identifier numbers and they should not be used, however,
this function ignores that. For example, number 15 (0x0f) is reserved for now, but this
functions returns Ok .
Auto Trait Implementations
Blanket Implementations
Mutably borrows from an owned value. Read more