[−][src]Struct cv::BitArray
A constant sized array of bits. B
defines the number of bytes.
This has an alignment of 64 to maximize the efficiency of SIMD operations.
It will automatically utilize SIMD at runtime where possible.
Fields
bytes: [u8; B]
Implementations
impl<const B: usize> BitArray<B>
[src]
pub fn new(bytes: [u8; B]) -> BitArray<B>
[src]
Create a new BitArray
.
use bitarray::BitArray; let array = BitArray::new([0]); assert_eq!(*array.bytes(), [0]);
pub fn zeros() -> BitArray<B>
[src]
Create a new BitArray
with all zeros.
use bitarray::BitArray; let array = BitArray::zeros(); assert_eq!(array, BitArray::new([0])); assert_eq!(*array, [0]);
pub fn bytes(&self) -> &[u8; B]
[src]
Retrieve the byte array of a BitArray
.
use bitarray::BitArray; let array = BitArray::new([1, 2]); assert_eq!(*array, [1, 2]);
pub fn bytes_mut(&mut self) -> &mut [u8; B]
[src]
Retrieve the mutable byte array of a BitArray
.
use bitarray::BitArray; let mut array = BitArray::new([1, 2]); array.bytes_mut()[0] = 3; assert_eq!(*array, [3, 2]);
pub fn weight(&self) -> usize
[src]
Compute the hamming weight of the BitArray
.
use bitarray::BitArray; let array = BitArray::new([0xAA; 83]); assert_eq!(array.weight(), 4 * 83);
pub fn distance(&self, other: &BitArray<B>) -> usize
[src]
Compute the hamming distance to another BitArray
.
use bitarray::BitArray; // All the bits are different. let a = BitArray::new([0xAA; 65]); let b = BitArray::new([0x55; 65]); assert_eq!(a.distance(&b), 8 * 65); // None of the bits are different. let a = BitArray::new([0xAA; 65]); let b = BitArray::new([0xAA; 65]); assert_eq!(a.distance(&b), 0);
Trait Implementations
impl<const B: usize> Clone for BitArray<B>
[src]
impl<const B: usize> Copy for BitArray<B>
[src]
impl<const B: usize> Debug for BitArray<B>
[src]
impl<const B: usize> Deref for BitArray<B>
[src]
use bitarray::BitArray; let mut array = BitArray::new([1, 2]); assert_eq!(*array, [1, 2]);
type Target = [u8; B]
The resulting type after dereferencing.
fn deref(&self) -> &<BitArray<B> as Deref>::Target
[src]
impl<const B: usize> DerefMut for BitArray<B>
[src]
use bitarray::BitArray; let mut array = BitArray::zeros(); array[0] = 1; array[1] = 2; assert_eq!(*array, [1, 2]);
impl<const B: usize> Eq for BitArray<B>
[src]
impl<const B: usize> Hash for BitArray<B>
[src]
fn hash<H>(&self, state: &mut H) where
H: Hasher,
[src]
H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<const B: usize> MetricPoint for BitArray<B>
[src]
impl<const B: usize> PartialEq<BitArray<B>> for BitArray<B>
[src]
Auto Trait Implementations
impl<const B: usize> RefUnwindSafe for BitArray<B>
impl<const B: usize> Send for BitArray<B>
impl<const B: usize> Sync for BitArray<B>
impl<const B: usize> Unpin for BitArray<B>
impl<const B: usize> UnwindSafe for BitArray<B>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> Scalar for T where
T: PartialEq<T> + Copy + Any + Debug,
[src]
T: PartialEq<T> + Copy + Any + Debug,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,