pub struct BitSequence {
pub bitmap: Option<Vec<u8>>,
pub padding: Option<i32>,
}
Expand description
A sequence of bits, encoded in a byte array. Each byte in the bitmap
byte array stores 8 bits of the sequence. The only exception is the last byte, which may store 8 or fewer bits. The padding
defines the number of bits of the last byte to be ignored as “padding”. The values of these “padding” bits are unspecified and must be ignored. To retrieve the first bit, bit 0, calculate: (bitmap[0] & 0x01) != 0
. To retrieve the second bit, bit 1, calculate: (bitmap[0] & 0x02) != 0
. To retrieve the third bit, bit 2, calculate: (bitmap[0] & 0x04) != 0
. To retrieve the fourth bit, bit 3, calculate: (bitmap[0] & 0x08) != 0
. To retrieve bit n, calculate: (bitmap[n / 8] & (0x01 << (n % 8))) != 0
. The “size” of a BitSequence
(the number of bits it contains) is calculated by this formula: (bitmap.length * 8) - padding
.
This type is not used in any activity, and only used as part of another schema.
Fields§
§bitmap: Option<Vec<u8>>
The bytes that encode the bit sequence. May have a length of zero.
padding: Option<i32>
The number of bits of the last byte in bitmap
to ignore as “padding”. If the length of bitmap
is zero, then this value must be 0
. Otherwise, this value must be between 0 and 7, inclusive.
Trait Implementations§
Source§impl Clone for BitSequence
impl Clone for BitSequence
Source§fn clone(&self) -> BitSequence
fn clone(&self) -> BitSequence
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for BitSequence
impl Debug for BitSequence
Source§impl Default for BitSequence
impl Default for BitSequence
Source§fn default() -> BitSequence
fn default() -> BitSequence
Source§impl<'de> Deserialize<'de> for BitSequence
impl<'de> Deserialize<'de> for BitSequence
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for BitSequence
impl Serialize for BitSequence
impl Part for BitSequence
Auto Trait Implementations§
impl Freeze for BitSequence
impl RefUnwindSafe for BitSequence
impl Send for BitSequence
impl Sync for BitSequence
impl Unpin for BitSequence
impl UnwindSafe for BitSequence
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more