Struct BitString
Source pub struct BitString { }
Available on crate feature pkcs8 only.
Expand description
Owned form of ASN.1 BIT STRING type.
This type provides the same functionality as BitStringRef but owns the
backing data.
Maximum number of unused bits allowed.
Create a new ASN.1 BIT STRING from a byte slice.
Accepts an optional number of “unused bits” (0-7) which are omitted
from the final octet. This number is 0 if the value is octet-aligned.
§Errors
Returns Error if any of the following occur:
unused_bits is invalid
bytes is too long
- an overflow occurred calculating the bit length
Create a new ASN.1 BIT STRING from the given bytes.
The “unused bits” are set to 0.
§Errors
If bytes is too long.
Get the number of unused bits in the octet serialization of this
BIT STRING.
Is the number of unused bits a value other than 0?
Get the length of this BIT STRING in bits.
Is the inner byte slice empty?
Borrow the inner byte slice.
Returns None if the number of unused bits is not equal to zero,
i.e. if the BIT STRING is not octet aligned.
Use BitString::raw_bytes to obtain access to the raw value
regardless of the presence of unused bits.
Borrow the raw bytes of this BIT STRING.
Iterator over the bits of this BIT STRING.
Returns Some(bit) if index is valid
Performs copy-assignment from
source.
Read more
Formats the value using the given formatter.
Read more
Type returned in the event of a decoding error.
Compute the length of this value (sans [
Tag]+
Length header) when
encoded as ASN.1 DER.
Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Compares and returns the maximum of two values.
Read more
Compares and returns the minimum of two values.
Read more
Restrict a value to a certain interval.
Read more
The resulting type referencing back to Self
Creates a new object referencing back to the self for storage
Tests for self and other values to be equal, and is used by ==.
Tests for !=. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
This method returns an ordering between
self and
other values if one exists.
Read more
Tests less than (for
self and
other) and is used by the
< operator.
Read more
Tests less than or equal to (for
self and
other) and is used by the
<= operator.
Read more
Tests greater than (for
self and
other) and is used by the
>
operator.
Read more
Tests greater than or equal to (for
self and
other) and is used by
the
>= operator.
Read moreSource§Available on crate feature alloc only.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Return an
Ordering between value portion of TLV-encoded
self and
other when serialized as ASN.1 DER.
Read more
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Is the provided
Tag decodable as a variant of this
CHOICE?
🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
Read more
Type returned in the event of a decoding error.
Attempt to decode this TLV message using the provided decoder.
Read more
Parse
Self from the provided DER-encoded byte slice.
Read more
Parse
Self from the provided DER-encoded byte slice.
Read more
Compute the length of this TLV object in bytes when encoded as ASN.1 DER.
Read more
Encode this TLV object to the provided byte slice, returning a sub-slice
containing the encoded message.
Read more
Available on crate feature alloc only.
Encode this TLV object as ASN.1 DER, appending it to the provided
byte vector.
Read more
Available on crate feature alloc only.
Encode this TLV object as ASN.1 DER, returning a byte vector.
Read more
Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From<T> for U chooses to do.
Get the ASN.1 tag that this type is encoded with.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more
Uses borrowed data to replace owned data, usually by cloning.
Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.