pub type FieldBits<V> = BitArray<V, Lsb0>;
Expand description
Bit representation of a field element.
Aliased Type§
struct FieldBits<V> {
pub _ord: PhantomData<Lsb0>,
pub data: V,
}
Fields§
§_ord: PhantomData<Lsb0>
The ordering of bits within an A::Store
element.
data: V
The wrapped data buffer.
Implementations
Source§impl<A, O> BitArray<A, O>where
A: BitViewSized,
O: BitOrder,
impl<A, O> BitArray<A, O>where
A: BitViewSized,
O: BitOrder,
Sourcepub fn new(data: A) -> BitArray<A, O>
pub fn new(data: A) -> BitArray<A, O>
Wraps an existing buffer as a bit-array.
§Examples
use bitvec::prelude::*;
let data = [0u16, 1, 2, 3];
let bits = BitArray::<_, Msb0>::new(data);
assert_eq!(bits.len(), 64);
Sourcepub fn into_inner(self) -> A
pub fn into_inner(self) -> A
Removes the bit-array wrapper, returning the contained buffer.
§Examples
use bitvec::prelude::*;
let bits = bitarr![0; 30];
let native: [usize; 1] = bits.into_inner();
Sourcepub fn as_bitslice(&self) -> &BitSlice<<A as BitView>::Store, O> ⓘ
pub fn as_bitslice(&self) -> &BitSlice<<A as BitView>::Store, O> ⓘ
Explicitly views the bit-array as a bit-slice.
Sourcepub fn as_mut_bitslice(&mut self) -> &mut BitSlice<<A as BitView>::Store, O> ⓘ
pub fn as_mut_bitslice(&mut self) -> &mut BitSlice<<A as BitView>::Store, O> ⓘ
Explicitly views the bit-array as a mutable bit-slice.
Sourcepub fn as_raw_slice(&self) -> &[<A as BitView>::Store]
pub fn as_raw_slice(&self) -> &[<A as BitView>::Store]
Views the bit-array as a slice of its underlying memory elements.
Sourcepub fn as_raw_mut_slice(&mut self) -> &mut [<A as BitView>::Store]
pub fn as_raw_mut_slice(&mut self) -> &mut [<A as BitView>::Store]
Views the bit-array as a mutable slice of its underlying memory elements.
Source§impl<A, O> BitArray<A, O>where
A: BitViewSized,
O: BitOrder,
impl<A, O> BitArray<A, O>where
A: BitViewSized,
O: BitOrder,
Sourcepub fn as_slice(&self) -> &BitSlice<<A as BitView>::Store, O> ⓘ
👎Deprecated: use .as_bitslice()
or .as_raw_slice()
instead
pub fn as_slice(&self) -> &BitSlice<<A as BitView>::Store, O> ⓘ
.as_bitslice()
or .as_raw_slice()
insteadReturns a bit-slice containing the entire bit-array. Equivalent to
&a[..]
.
Because BitArray
can be viewed as a slice of bits or as a slice of
elements with equal ease, you should switch to using .as_bitslice()
or .as_raw_slice()
to make your choice explicit.
§Original
Sourcepub fn as_mut_slice(&mut self) -> &mut BitSlice<<A as BitView>::Store, O> ⓘ
👎Deprecated: use .as_mut_bitslice()
or .as_raw_mut_slice()
instead
pub fn as_mut_slice(&mut self) -> &mut BitSlice<<A as BitView>::Store, O> ⓘ
.as_mut_bitslice()
or .as_raw_mut_slice()
insteadReturns a mutable bit-slice containing the entire bit-array. Equivalent
to &mut a[..]
.
Because BitArray
can be viewed as a slice of bits or as a slice of
elements with equal ease, you should switch to using
.as_mut_bitslice()
or .as_raw_mut_slice()
to make your choice
explicit.
§Original
Trait Implementations
Source§impl<A, O> AsMut<BitSlice<<A as BitView>::Store, O>> for BitArray<A, O>where
A: BitViewSized,
O: BitOrder,
impl<A, O> AsMut<BitSlice<<A as BitView>::Store, O>> for BitArray<A, O>where
A: BitViewSized,
O: BitOrder,
Source§impl<A, O> AsRef<BitSlice<<A as BitView>::Store, O>> for BitArray<A, O>where
A: BitViewSized,
O: BitOrder,
impl<A, O> AsRef<BitSlice<<A as BitView>::Store, O>> for BitArray<A, O>where
A: BitViewSized,
O: BitOrder,
Source§impl<A, O, Rhs> BitAndAssign<Rhs> for BitArray<A, O>
impl<A, O, Rhs> BitAndAssign<Rhs> for BitArray<A, O>
Source§fn bitand_assign(&mut self, rhs: Rhs)
fn bitand_assign(&mut self, rhs: Rhs)
&=
operation. Read moreSource§impl<A, O> BitField for BitArray<A, O>
§Bit-Array Implementation of BitField
The BitArray
implementation is only ever called when the entire bit-array is
available for use, which means it can skip the bit-slice memory detection and
instead use the underlying storage elements directly.
impl<A, O> BitField for BitArray<A, O>
§Bit-Array Implementation of BitField
The BitArray
implementation is only ever called when the entire bit-array is
available for use, which means it can skip the bit-slice memory detection and
instead use the underlying storage elements directly.
The implementation still performs the segmentation for each element contained in the array, in order to maintain value consistency so that viewing the array as a bit-slice is still able to correctly interact with data contained in it.
Source§impl<A, O, Rhs> BitOrAssign<Rhs> for BitArray<A, O>
impl<A, O, Rhs> BitOrAssign<Rhs> for BitArray<A, O>
Source§fn bitor_assign(&mut self, rhs: Rhs)
fn bitor_assign(&mut self, rhs: Rhs)
|=
operation. Read moreSource§impl<A, O, Rhs> BitXorAssign<Rhs> for BitArray<A, O>
impl<A, O, Rhs> BitXorAssign<Rhs> for BitArray<A, O>
Source§fn bitxor_assign(&mut self, rhs: Rhs)
fn bitxor_assign(&mut self, rhs: Rhs)
^=
operation. Read more