Struct smallbitset::Set32

source ·
pub struct Set32 { /* private fields */ }
Expand description

This structure implemts a bitset with a maximum capacity of $capa bits. The structure requires no dynamic allocation and it is therefore fully copiable

Implementations§

source§

impl Set32

source

pub const fn empty() -> Self

Creates an empty set

source

pub const fn full() -> Self

Creates a set where all items are present

source

pub const fn singleton(x: usize) -> Self

Creates a singleton set comprising one single item

source

pub const fn capacity(self) -> usize

Returns the capacity of the bitset

source

pub fn len(self) -> usize

Returns the lenght of the set. That is the number of itemes present (value of the bit is 1) in the set

source

pub fn is_empty(self) -> bool

Returns true iff the set is empty

source

pub const fn contains(self, x: usize) -> bool

Returns true iff the set contains item ‘x’

source

pub const fn add(self, x: usize) -> Self

Returns a new set where item x is present in the set

source

pub fn add_inplace(&mut self, x: usize) -> &mut Self

Adds the item x to this set

source

pub const fn remove(self, x: usize) -> Self

Returns a new set where item x is absent from the set

source

pub fn remove_inplace(&mut self, x: usize) -> &mut Self

Removes x from the current set

source

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

Returns the union of both sets

source

pub fn union_inplace(&mut self, other: &Self) -> &mut Self

Updates this set so that it contains the union of self and other

source

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

Returns a set which is the intersection of both sets

source

pub fn inter_inplace(&mut self, other: &Self) -> &mut Self

Updates this set so that it contains the intersection of self and other

source

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

Returns a set which is the difference of the two sets

source

pub fn diff_inplace(&mut self, other: &Self) -> &mut Self

Updates this set so that it contains the difference of self and other

source

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

Returns a set which is the exclusive or of the two sets

source

pub fn symmetric_difference_inplace(&mut self, other: &Self) -> &mut Self

Updates this set so that it contains the exclusive or of self and other

source

pub fn flip(self) -> Self

Flips all the bits of self (all members are removed, all absent are added)

source

pub fn flip_inplace(&mut self) -> &mut Self

Updates this set so that it contains the negation of self

source

pub fn contains_all(self, other: Self) -> bool

Returns true iff this set contains all the elements of the other set. (self is a superset of other).

source

pub fn disjoint(self, other: Self) -> bool

Return true iff the two sets are disjoint

source

pub fn intersects(&self, other: Self) -> bool

Returns true iff the intersects with other set

source

pub fn iter(&self) -> impl Iterator<Item = usize> + '_

Returns an iterator that goes over all the items present in this set

source

pub fn ones(&self) -> impl Iterator<Item = usize> + '_

Returns an iterator that goes over all the items present in this set

source

pub fn zeroes(&self) -> impl Iterator<Item = usize> + '_

Returns an iterator that goes over all the items absent from this set

source

pub fn subsets(&self, of_size: usize) -> impl Iterator<Item = Self> + '_

Returns an iterator that goes over all the items absent from this set Requires the alloc feature

source

pub const fn inc(self) -> Self

Returns the next value when considering the bitset as a large integer value and incrementing it by one.

source

pub fn inc_inplace(&mut self) -> &mut Self

Consider the bitset as a large integer value and increments it by one

Trait Implementations§

source§

impl BitAnd<Set32> for Set32

§

type Output = Set32

The resulting type after applying the & operator.
source§

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

Performs the & operation. Read more
source§

impl BitAndAssign<Set32> for Set32

source§

fn bitand_assign(&mut self, rhs: Self)

Performs the &= operation. Read more
source§

impl BitOr<Set32> for Set32

§

type Output = Set32

The resulting type after applying the | operator.
source§

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

Performs the | operation. Read more
source§

impl BitOrAssign<Set32> for Set32

source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation. Read more
source§

impl BitXor<Set32> for Set32

§

type Output = Set32

The resulting type after applying the ^ operator.
source§

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

Performs the ^ operation. Read more
source§

impl BitXorAssign<Set32> for Set32

source§

fn bitxor_assign(&mut self, rhs: Self)

Performs the ^= operation. Read more
source§

impl Clone for Set32

source§

fn clone(&self) -> Set32

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 Set32

source§

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

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

impl Default for Set32

source§

fn default() -> Self

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

impl Display for Set32

source§

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

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

impl From<[u32; 1]> for Set32

source§

fn from(x: [u32; 1]) -> Set32

Converts to this type from the input type.
source§

impl From<Set32> for [u32; 1]

source§

fn from(x: Set32) -> [u32; 1]

Converts to this type from the input type.
source§

impl From<Set32> for u32

source§

fn from(x: Set32) -> u32

Converts to this type from the input type.
source§

impl From<u32> for Set32

source§

fn from(x: u32) -> Set32

Converts to this type from the input type.
source§

impl Hash for Set32

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 Not for Set32

§

type Output = Set32

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl Ord for Set32

source§

fn cmp(&self, other: &Set32) -> 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<Set32> for Set32

source§

fn eq(&self, other: &Set32) -> 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<Set32> for Set32

source§

fn partial_cmp(&self, other: &Set32) -> 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 Copy for Set32

source§

impl Eq for Set32

source§

impl StructuralEq for Set32

source§

impl StructuralPartialEq for Set32

Auto Trait Implementations§

§

impl RefUnwindSafe for Set32

§

impl Send for Set32

§

impl Sync for Set32

§

impl Unpin for Set32

§

impl UnwindSafe for Set32

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
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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.