pub struct BitString<'a> { /* private fields */ }
Expand description
ASN.1 BIT STRING
type.
This type contains a sequence of any number of bits, modeled internally as a sequence of bytes with a known number of “unused bits”.
Implementations
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.
Create a new ASN.1 BIT STRING
from the given bytes.
The “unused bits” are set to 0.
Get the number of unused bits in this byte slice.
Is the number of unused bits a value other than 0?
Get the number of bytes/octets needed to represent this BIT STRING
when serialized in an octet-aligned manner.
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
.
Note that the byte string may contain extra unused bits in the final
octet. If the number of unused bits is expected to be 0, the
BitString::as_bytes
function can be used instead.
pub fn bits(self) -> BitStringIter<'a>ⓘNotable traits for BitStringIter<'a>impl<'a> Iterator for BitStringIter<'a> type Item = bool;
pub fn bits(self) -> BitStringIter<'a>ⓘNotable traits for BitStringIter<'a>impl<'a> Iterator for BitStringIter<'a> type Item = bool;
impl<'a> Iterator for BitStringIter<'a> type Item = bool;
Iterator over the bits of this BIT STRING
.
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
Hack for simplifying the custom derive use case.
Auto Trait Implementations
impl<'a> RefUnwindSafe for BitString<'a>
impl<'a> UnwindSafe for BitString<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more