Struct FixedBitSet

Source
#[repr(C, packed(1))]
pub struct FixedBitSet<B = u64> { /* private fields */ }
Expand description

A bit set that, once created, has a fixed size over time.

The set can store at most u16::MAX number of bits.

Implementations§

Source§

impl<B: BitBlock> FixedBitSet<B>

Source

pub fn new(bits: usize) -> Self

Allocates a new bit set capable of holding bits number of bits.

Source

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

Returns whether idx is set or not.

Source

pub fn set(&mut self, idx: usize, val: bool)

Sets bit at position idx to val.

Source

pub fn clear(&mut self)

Clears every bit in the vec.

Source

pub fn iter_set(&self) -> IterSet<'_, B>

Returns all the set indices.

Source

pub fn iter_set_from(&self, start_idx: usize) -> IterSet<'_, B>

Returns all the set indices from start_idx inclusive.

Trait Implementations§

Source§

impl<B: BitBlock> Debug for FixedBitSet<B>

Source§

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

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

impl<'de, B: BitBlock + Deserialize<'de>> Deserialize<'de> for FixedBitSet<B>

Source§

fn deserialize<D: Deserializer<'de>>(de: D) -> Result<Self, D::Error>

Deserialize this value from the given deserializer.
Source§

impl<B> Drop for FixedBitSet<B>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<B> MemoryUsage for FixedBitSet<B>

Source§

fn heap_usage(&self) -> usize

The heap memory usage of this type. The default implementation returns 0.
Source§

impl<B: BitBlock> PartialEq for FixedBitSet<B>

Source§

fn eq(&self, other: &Self) -> 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<B: BitBlock + Serialize> Serialize for FixedBitSet<B>

Source§

fn serialize<S: Serializer>(&self, ser: S) -> Result<S::Ok, S::Error>

Serialize self in the data format of S using the provided serializer.
Source§

impl<B: BitBlock> Eq for FixedBitSet<B>

Source§

impl<B> Send for FixedBitSet<B>

Source§

impl<B> Sync for FixedBitSet<B>

Auto Trait Implementations§

§

impl<B> Freeze for FixedBitSet<B>

§

impl<B> RefUnwindSafe for FixedBitSet<B>
where B: RefUnwindSafe,

§

impl<B> Unpin for FixedBitSet<B>

§

impl<B> UnwindSafe for FixedBitSet<B>
where B: RefUnwindSafe,

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<Q, K> Equivalent<K> for Q
where 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 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Satn for T
where T: Serialize + ?Sized,

Source§

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

Formats the value using the SATN data format into the formatter f.
Source§

fn fmt_psql(&self, f: &mut Formatter<'_>, ty: &ProductType) -> Result<(), Error>

Formats the value using the postgres SATN(SatnFormatter { f }, /* AlgebraicType */) formatter f.
Source§

fn to_satn(&self) -> String

Formats the value using the SATN data format into the returned String.
Source§

fn to_satn_pretty(&self) -> String

Pretty prints the value using the SATN data format into the returned String.
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.
Source§

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