pub struct Oid<'a>(/* private fields */);Expand description
An object identifier, as the arcs are encoded, without the tag or length.
Held encoded rather than decoded because identity is the encoding: two
identifiers are the same one when their bytes match, and comparing rendered
text instead would make 1.2.840.113549 and a lookalike written with an
arc padded to the same digits into the same identifier.
Implementations§
Source§impl<'a> Oid<'a>
impl<'a> Oid<'a>
Sourcepub const fn from_bytes(bytes: &'a [u8]) -> Self
pub const fn from_bytes(bytes: &'a [u8]) -> Self
An identifier from written-out bytes, validated as it is built.
For the constants a schema names. The same rules the document reader enforces are held here by construction, so a table entry cannot name something no document could: a malformed constant fails the build during constant evaluation, and a malformed runtime call panics at the constructor rather than printing nonsense later. Document bytes never come through here; the parser validates them.
§Panics
When the bytes are not a well formed object identifier: empty, a padded arc, or a truncated continuation. Width is not among them, as it is not for a document: the encoding bounds no subidentifier (X.690 8.19.2).
Sourcepub fn text(self, execution: &Memory) -> Result<OwnedString, MemoryError>
pub fn text(self, execution: &Memory) -> Result<OwnedString, MemoryError>
Exact dotted-decimal text, admitting conversion work and storage in the current execution domain. The result retains its capacity charge. Width is unrestricted by ASN.1; insufficient resources return an error.
Sourcepub fn arcs(self) -> Arcs<'a> ⓘ
pub fn arcs(self) -> Arcs<'a> ⓘ
The arcs, root first.
Constructing the iterator is constant work. Advancing it scans the
encoded groups of one subidentifier; the caller must admit that work
when iterating untrusted input. Self::text accounts for its traversal.