pub struct TinyBitSet(u16);
Expand description

A bit-set implemented with a u16, supporting domains up to 16 elements.

Tuple Fields§

§0: u16

Implementations§

source§

impl TinyBitSet

source

pub fn new_empty() -> Self

Creates a new, empty bitset.

source

pub fn set(&mut self, index: u32)

Sets the indexth bit.

source

pub fn clear(&mut self, index: u32)

Unsets the indexth bit.

source

pub fn set_range(&mut self, range: Range<u32>)

Sets the ith to jth bits.

source

pub fn is_empty(self) -> bool

Is the set empty?

source

pub fn within_domain(self, index: u32) -> bool

Returns the domain size of the bitset.

source

pub fn count(self) -> u32

How many bits are set to true?

source

pub fn contains(self, index: u32) -> Option<bool>

Returns if the indexth bit is set.

source

pub fn is_set(self, index: u32) -> bool

Similar to Self::contains but in the case of an index outside the domain it returns false instead of None.

source

pub fn into_iter_set_in_domain(self) -> impl Iterator<Item = u32> + Clone

Iterate over all set indices that are within the domain (less than 16).

source

pub fn display_pretty(self) -> DisplayTinyBitSet

Create a struct with a pretty Display implementation for this tiny bit set.

source

pub fn intersection(self, other: Self) -> Self

A new bit set that contains elements that are both in self and other. Same as using &

Trait Implementations§

source§

impl BitAnd<TinyBitSet> for TinyBitSet

§

type Output = TinyBitSet

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
source§

impl BitAndAssign<TinyBitSet> for TinyBitSet

source§

fn bitand_assign(&mut self, rhs: Self)

Performs the &= operation. Read more
source§

impl BitOr<TinyBitSet> for TinyBitSet

§

type Output = TinyBitSet

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
source§

impl BitOrAssign<TinyBitSet> for TinyBitSet

source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation. Read more
source§

impl BitXor<TinyBitSet> for TinyBitSet

§

type Output = TinyBitSet

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Self) -> Self::Output

Performs the ^ operation. Read more
source§

impl BitXorAssign<TinyBitSet> for TinyBitSet

source§

fn bitxor_assign(&mut self, rhs: Self)

Performs the ^= operation. Read more
source§

impl Clone for TinyBitSet

source§

fn clone(&self) -> TinyBitSet

Returns a copy 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 Debug for TinyBitSet

source§

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

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

impl<__D: Decoder> Decodable<__D> for TinyBitSet

source§

fn decode(__decoder: &mut __D) -> Self

source§

impl Default for TinyBitSet

source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for TinyBitSet

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<__E: Encoder> Encodable<__E> for TinyBitSet

source§

fn encode(&self, __encoder: &mut __E)

source§

impl FromIterator<u32> for TinyBitSet

source§

fn from_iter<T: IntoIterator<Item = u32>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl Hash for TinyBitSet

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 Ord for TinyBitSet

source§

fn cmp(&self, other: &TinyBitSet) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<TinyBitSet> for TinyBitSet

source§

fn eq(&self, other: &TinyBitSet) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<TinyBitSet> for TinyBitSet

source§

fn partial_cmp(&self, other: &TinyBitSet) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for TinyBitSet

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Copy for TinyBitSet

source§

impl Eq for TinyBitSet

source§

impl StructuralEq for TinyBitSet

source§

impl StructuralPartialEq for TinyBitSet

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

impl<T> CallHasher for Twhere T: Hash + ?Sized,

§

default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64where H: Hash + ?Sized, B: BuildHasher,

source§

impl<Q, K> Comparable<K> for Qwhere Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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 Twhere T: Clone,

§

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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,

source§

impl<N> NodeTrait for Nwhere N: Copy + Ord + Hash,