Struct Complement

Source
#[repr(transparent)]
pub struct Complement<T>(pub T);
Expand description

Bit-set wrapper that acts like set complement.

Effectively inverses all bits in the underlying bit-set.

Tuple Fields§

§0: T

Implementations§

Source§

impl<T> Complement<T>

Source

pub fn inner(&self) -> &T

Source

pub fn inner_mut(&mut self) -> &mut T

Source

pub fn into_inner(self) -> T

Source§

impl<T> Complement<Complement<T>>

Source

pub fn double_complement_unwrap(self) -> T

Convenience function to unwrap double Complement wrapper which must yield bitset with same bits set.

Trait Implementations§

Source§

impl<T> BitComplement for Complement<T>

Source§

type Output = T

Source§

fn complement(self) -> T

Source§

impl<const N: usize> BitDifference<Complement<[u128; N]>> for [u128; N]

Source§

type Output = [u128; N]

Source§

fn difference(self, rhs: Complement<Self>) -> Self

Returns bit-set has bits set for each index that has bit set in exactly one of two arguments.
Source§

impl<const N: usize> BitDifference<Complement<[u16; N]>> for [u16; N]

Source§

type Output = [u16; N]

Source§

fn difference(self, rhs: Complement<Self>) -> Self

Returns bit-set has bits set for each index that has bit set in exactly one of two arguments.
Source§

impl<const N: usize> BitDifference<Complement<[u32; N]>> for [u32; N]

Source§

type Output = [u32; N]

Source§

fn difference(self, rhs: Complement<Self>) -> Self

Returns bit-set has bits set for each index that has bit set in exactly one of two arguments.
Source§

impl<const N: usize> BitDifference<Complement<[u64; N]>> for [u64; N]

Source§

type Output = [u64; N]

Source§

fn difference(self, rhs: Complement<Self>) -> Self

Returns bit-set has bits set for each index that has bit set in exactly one of two arguments.
Source§

impl<const N: usize> BitDifference<Complement<[u8; N]>> for [u8; N]

Source§

type Output = [u8; N]

Source§

fn difference(self, rhs: Complement<Self>) -> Self

Returns bit-set has bits set for each index that has bit set in exactly one of two arguments.
Source§

impl BitDifference<Complement<bool>> for bool

Source§

type Output = bool

Source§

fn difference(self, rhs: Complement<Self>) -> Self

Returns bit-set has bits set for each index that has bit set in exactly one of two arguments.
Source§

impl BitDifference<Complement<u128>> for u128

Source§

type Output = u128

Source§

fn difference(self, rhs: Complement<Self>) -> Self

Returns bit-set has bits set for each index that has bit set in exactly one of two arguments.
Source§

impl BitDifference<Complement<u16>> for u16

Source§

type Output = u16

Source§

fn difference(self, rhs: Complement<Self>) -> Self

Returns bit-set has bits set for each index that has bit set in exactly one of two arguments.
Source§

impl BitDifference<Complement<u32>> for u32

Source§

type Output = u32

Source§

fn difference(self, rhs: Complement<Self>) -> Self

Returns bit-set has bits set for each index that has bit set in exactly one of two arguments.
Source§

impl BitDifference<Complement<u64>> for u64

Source§

type Output = u64

Source§

fn difference(self, rhs: Complement<Self>) -> Self

Returns bit-set has bits set for each index that has bit set in exactly one of two arguments.
Source§

impl BitDifference<Complement<u8>> for u8

Source§

type Output = u8

Source§

fn difference(self, rhs: Complement<Self>) -> Self

Returns bit-set has bits set for each index that has bit set in exactly one of two arguments.
Source§

impl<T, U> BitDifference<U> for Complement<T>
where T: BitUnion<U>,

Source§

type Output = Complement<<T as BitUnion<U>>::Output>

Source§

fn difference(self, rhs: U) -> Self::Output

Returns bit-set has bits set for each index that has bit set in exactly one of two arguments.
Source§

impl<const N: usize> BitDisjoint<Complement<[u128; N]>> for [u128; N]

Source§

fn is_disjoint(&self, rhs: &Complement<Self>) -> bool

Returns true if self is disjoint with rhs.
Source§

impl<const N: usize> BitDisjoint<Complement<[u16; N]>> for [u16; N]

Source§

fn is_disjoint(&self, rhs: &Complement<Self>) -> bool

Returns true if self is disjoint with rhs.
Source§

impl<const N: usize> BitDisjoint<Complement<[u32; N]>> for [u32; N]

Source§

fn is_disjoint(&self, rhs: &Complement<Self>) -> bool

Returns true if self is disjoint with rhs.
Source§

impl<const N: usize> BitDisjoint<Complement<[u64; N]>> for [u64; N]

Source§

fn is_disjoint(&self, rhs: &Complement<Self>) -> bool

Returns true if self is disjoint with rhs.
Source§

impl<const N: usize> BitDisjoint<Complement<[u8; N]>> for [u8; N]

Source§

fn is_disjoint(&self, rhs: &Complement<Self>) -> bool

Returns true if self is disjoint with rhs.
Source§

impl BitDisjoint<Complement<bool>> for bool

Source§

fn is_disjoint(&self, rhs: &Complement<Self>) -> bool

Returns true if self is disjoint with rhs.
Source§

impl BitDisjoint<Complement<u128>> for u128

Source§

fn is_disjoint(&self, rhs: &Complement<Self>) -> bool

Returns true if self is disjoint with rhs.
Source§

impl BitDisjoint<Complement<u16>> for u16

Source§

fn is_disjoint(&self, rhs: &Complement<Self>) -> bool

Returns true if self is disjoint with rhs.
Source§

impl BitDisjoint<Complement<u32>> for u32

Source§

fn is_disjoint(&self, rhs: &Complement<Self>) -> bool

Returns true if self is disjoint with rhs.
Source§

impl BitDisjoint<Complement<u64>> for u64

Source§

fn is_disjoint(&self, rhs: &Complement<Self>) -> bool

Returns true if self is disjoint with rhs.
Source§

impl BitDisjoint<Complement<u8>> for u8

Source§

fn is_disjoint(&self, rhs: &Complement<Self>) -> bool

Returns true if self is disjoint with rhs.
Source§

impl<T, U> BitDisjoint<U> for Complement<T>
where U: BitSubset<T>,

Source§

fn is_disjoint(&self, rhs: &U) -> bool

Returns true if self is disjoint with rhs.
Source§

impl<T> BitEmpty for Complement<T>
where T: BitFull,

Source§

fn empty() -> Self

Returns empty bitset for which all bits are unset.
Source§

impl<T> BitFull for Complement<T>
where T: BitEmpty,

Source§

fn full() -> Self

Returns full bitset for which all bits are set.
Source§

impl<const N: usize> BitIntersection<Complement<[u128; N]>> for [u128; N]

Source§

type Output = [u128; N]

Source§

fn intersection(self, rhs: Complement<Self>) -> Self

Returns bit-set with bits set for each index that has bit set in either of two arguments.
Source§

impl<const N: usize> BitIntersection<Complement<[u16; N]>> for [u16; N]

Source§

type Output = [u16; N]

Source§

fn intersection(self, rhs: Complement<Self>) -> Self

Returns bit-set with bits set for each index that has bit set in either of two arguments.
Source§

impl<const N: usize> BitIntersection<Complement<[u32; N]>> for [u32; N]

Source§

type Output = [u32; N]

Source§

fn intersection(self, rhs: Complement<Self>) -> Self

Returns bit-set with bits set for each index that has bit set in either of two arguments.
Source§

impl<const N: usize> BitIntersection<Complement<[u64; N]>> for [u64; N]

Source§

type Output = [u64; N]

Source§

fn intersection(self, rhs: Complement<Self>) -> Self

Returns bit-set with bits set for each index that has bit set in either of two arguments.
Source§

impl<const N: usize> BitIntersection<Complement<[u8; N]>> for [u8; N]

Source§

type Output = [u8; N]

Source§

fn intersection(self, rhs: Complement<Self>) -> Self

Returns bit-set with bits set for each index that has bit set in either of two arguments.
Source§

impl BitIntersection<Complement<bool>> for bool

Source§

type Output = bool

Source§

fn intersection(self, rhs: Complement<Self>) -> Self

Returns bit-set with bits set for each index that has bit set in either of two arguments.
Source§

impl BitIntersection<Complement<u128>> for u128

Source§

type Output = u128

Source§

fn intersection(self, rhs: Complement<Self>) -> Self

Returns bit-set with bits set for each index that has bit set in either of two arguments.
Source§

impl BitIntersection<Complement<u16>> for u16

Source§

type Output = u16

Source§

fn intersection(self, rhs: Complement<Self>) -> Self

Returns bit-set with bits set for each index that has bit set in either of two arguments.
Source§

impl BitIntersection<Complement<u32>> for u32

Source§

type Output = u32

Source§

fn intersection(self, rhs: Complement<Self>) -> Self

Returns bit-set with bits set for each index that has bit set in either of two arguments.
Source§

impl BitIntersection<Complement<u64>> for u64

Source§

type Output = u64

Source§

fn intersection(self, rhs: Complement<Self>) -> Self

Returns bit-set with bits set for each index that has bit set in either of two arguments.
Source§

impl BitIntersection<Complement<u8>> for u8

Source§

type Output = u8

Source§

fn intersection(self, rhs: Complement<Self>) -> Self

Returns bit-set with bits set for each index that has bit set in either of two arguments.
Source§

impl<T, U> BitIntersection<U> for Complement<T>
where U: BitDifference<T>,

Source§

type Output = <U as BitDifference<T>>::Output

Source§

fn intersection(self, rhs: U) -> Self::Output

Returns bit-set with bits set for each index that has bit set in either of two arguments.
Source§

impl<T> BitSearch for Complement<Complement<T>>
where T: BitSearch,

Source§

fn find_first_set(&self, lower_bound: usize) -> Option<usize>

Searches for first bit set starting with lower_bound. Returns index of first bit set. Read more
Source§

fn find_set_in_range<R>(&self, range: R) -> Option<usize>
where R: RangeBounds<usize>,

Searches for bit set specified range. Returns index of bit set. Read more
Source§

impl<T> BitSet for Complement<T>
where T: BitUnset,

Source§

unsafe fn set_unchecked(&mut self, idx: usize)

Set bit at specified index. Read more
Source§

fn set(&mut self, idx: usize)

Sets bit at specified index. Read more
Source§

impl<T> BitSetLimit for Complement<T>
where T: BitUnsetLimit,

Source§

const MAX_SET_INDEX: usize = T::MAX_UNSET_INDEX

Largest possible bit index that can be set. Any larger index will always be unset. Setting larger index is now allowed. Read more
Source§

impl<const N: usize> BitSubset<Complement<[u128; N]>> for [u128; N]

Source§

fn is_subset_of(&self, rhs: &Complement<Self>) -> bool

Returns true if self is subset of rhs.
Source§

impl<const N: usize> BitSubset<Complement<[u16; N]>> for [u16; N]

Source§

fn is_subset_of(&self, rhs: &Complement<Self>) -> bool

Returns true if self is subset of rhs.
Source§

impl<const N: usize> BitSubset<Complement<[u32; N]>> for [u32; N]

Source§

fn is_subset_of(&self, rhs: &Complement<Self>) -> bool

Returns true if self is subset of rhs.
Source§

impl<const N: usize> BitSubset<Complement<[u64; N]>> for [u64; N]

Source§

fn is_subset_of(&self, rhs: &Complement<Self>) -> bool

Returns true if self is subset of rhs.
Source§

impl<const N: usize> BitSubset<Complement<[u8; N]>> for [u8; N]

Source§

fn is_subset_of(&self, rhs: &Complement<Self>) -> bool

Returns true if self is subset of rhs.
Source§

impl BitSubset<Complement<bool>> for bool

Source§

fn is_subset_of(&self, rhs: &Complement<Self>) -> bool

Returns true if self is subset of rhs.
Source§

impl BitSubset<Complement<u128>> for u128

Source§

fn is_subset_of(&self, rhs: &Complement<Self>) -> bool

Returns true if self is subset of rhs.
Source§

impl BitSubset<Complement<u16>> for u16

Source§

fn is_subset_of(&self, rhs: &Complement<Self>) -> bool

Returns true if self is subset of rhs.
Source§

impl BitSubset<Complement<u32>> for u32

Source§

fn is_subset_of(&self, rhs: &Complement<Self>) -> bool

Returns true if self is subset of rhs.
Source§

impl BitSubset<Complement<u64>> for u64

Source§

fn is_subset_of(&self, rhs: &Complement<Self>) -> bool

Returns true if self is subset of rhs.
Source§

impl BitSubset<Complement<u8>> for u8

Source§

fn is_subset_of(&self, rhs: &Complement<Self>) -> bool

Returns true if self is subset of rhs.
Source§

impl<T> BitTest for Complement<T>
where T: BitTest,

Source§

fn test(&self, idx: usize) -> bool

Tests if bit at specified index is set.
Source§

impl<T> BitTestAll for Complement<T>
where T: BitTestNone,

Source§

fn test_all(&self) -> bool

Tests if all bits are set.
Source§

impl<T> BitTestNone for Complement<T>
where T: BitTestAll,

Source§

fn test_none(&self) -> bool

Tests if none bits is set.
Source§

impl<const N: usize> BitUnion<Complement<[u128; N]>> for [u128; N]

Source§

type Output = Complement<[u128; N]>

Source§

fn union(self, rhs: Complement<Self>) -> Complement<Self>

Returns bit-set with bits set for each index that has bit set in both of two arguments.
Source§

impl<const N: usize> BitUnion<Complement<[u16; N]>> for [u16; N]

Source§

type Output = Complement<[u16; N]>

Source§

fn union(self, rhs: Complement<Self>) -> Complement<Self>

Returns bit-set with bits set for each index that has bit set in both of two arguments.
Source§

impl<const N: usize> BitUnion<Complement<[u32; N]>> for [u32; N]

Source§

type Output = Complement<[u32; N]>

Source§

fn union(self, rhs: Complement<Self>) -> Complement<Self>

Returns bit-set with bits set for each index that has bit set in both of two arguments.
Source§

impl<const N: usize> BitUnion<Complement<[u64; N]>> for [u64; N]

Source§

type Output = Complement<[u64; N]>

Source§

fn union(self, rhs: Complement<Self>) -> Complement<Self>

Returns bit-set with bits set for each index that has bit set in both of two arguments.
Source§

impl<const N: usize> BitUnion<Complement<[u8; N]>> for [u8; N]

Source§

type Output = Complement<[u8; N]>

Source§

fn union(self, rhs: Complement<Self>) -> Complement<Self>

Returns bit-set with bits set for each index that has bit set in both of two arguments.
Source§

impl BitUnion<Complement<bool>> for bool

Source§

type Output = Complement<bool>

Source§

fn union(self, rhs: Complement<Self>) -> Complement<Self>

Returns bit-set with bits set for each index that has bit set in both of two arguments.
Source§

impl BitUnion<Complement<u128>> for u128

Source§

type Output = Complement<u128>

Source§

fn union(self, rhs: Complement<Self>) -> Complement<Self>

Returns bit-set with bits set for each index that has bit set in both of two arguments.
Source§

impl BitUnion<Complement<u16>> for u16

Source§

type Output = Complement<u16>

Source§

fn union(self, rhs: Complement<Self>) -> Complement<Self>

Returns bit-set with bits set for each index that has bit set in both of two arguments.
Source§

impl BitUnion<Complement<u32>> for u32

Source§

type Output = Complement<u32>

Source§

fn union(self, rhs: Complement<Self>) -> Complement<Self>

Returns bit-set with bits set for each index that has bit set in both of two arguments.
Source§

impl BitUnion<Complement<u64>> for u64

Source§

type Output = Complement<u64>

Source§

fn union(self, rhs: Complement<Self>) -> Complement<Self>

Returns bit-set with bits set for each index that has bit set in both of two arguments.
Source§

impl BitUnion<Complement<u8>> for u8

Source§

type Output = Complement<u8>

Source§

fn union(self, rhs: Complement<Self>) -> Complement<Self>

Returns bit-set with bits set for each index that has bit set in both of two arguments.
Source§

impl<T, U> BitUnion<U> for Complement<T>
where T: BitDifference<U>,

Source§

type Output = Complement<<T as BitDifference<U>>::Output>

Source§

fn union(self, rhs: U) -> Self::Output

Returns bit-set with bits set for each index that has bit set in both of two arguments.
Source§

impl<T> BitUnset for Complement<T>
where T: BitSet,

Source§

unsafe fn unset_unchecked(&mut self, idx: usize)

Unsets bit at specified index. Read more
Source§

fn unset(&mut self, idx: usize)

Unsets bit at specified index. Read more
Source§

impl<T> BitUnsetLimit for Complement<T>
where T: BitSetLimit,

Source§

const MAX_UNSET_INDEX: usize = T::MAX_SET_INDEX

Largest possible bit index that can be unset. Any larger index will always be set. Unsetting larger index is now allowed. Read more
Source§

impl<T: Clone> Clone for Complement<T>

Source§

fn clone(&self) -> Complement<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Complement<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default> Default for Complement<T>

Source§

fn default() -> Complement<T>

Returns the “default value” for a type. Read more
Source§

impl<T> Display for Complement<T>
where T: Display,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Hash> Hash for Complement<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: PartialEq> PartialEq for Complement<T>

Source§

fn eq(&self, other: &Complement<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Copy> Copy for Complement<T>

Source§

impl<T: Eq> Eq for Complement<T>

Source§

impl<T> StructuralPartialEq for Complement<T>

Auto Trait Implementations§

§

impl<T> Freeze for Complement<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Complement<T>
where T: RefUnwindSafe,

§

impl<T> Send for Complement<T>
where T: Send,

§

impl<T> Sync for Complement<T>
where T: Sync,

§

impl<T> Unpin for Complement<T>
where T: Unpin,

§

impl<T> UnwindSafe for Complement<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.