Skip to main content

InlineScanSet

Struct InlineScanSet 

Source
pub struct InlineScanSet<T, const SZ: usize> { /* private fields */ }
Expand description

A general-purpose set implemented using linear scanning.

This type is an implementation detail of the `frozen_collections` crate. This API is therefore not stable and may change at any time. Please do not use this type directly, and instead use the public API provided by the `frozen_collections` crate.
A frozen collection differs from the traditional Rust collections, such as [`HashMap`](std::collections::HashMap) and [`HashSet`](std::collections::HashSet) types in three key ways. First, creating a frozen collection performs an analysis over the input data to determine the best implementation strategy. Depending on the situation, this analysis is performed at build time or runtime, and it can take a relatively long time when a collection is very large. Second, once created, the keys in frozen collections are immutable. And third, querying a frozen collection is typically considerably faster, which is the whole point.

§Type Parameters

  • T: The value type.
  • SZ: The number of entries in the set.

Implementations§

Source§

impl<T, const SZ: usize> InlineScanSet<T, SZ>

Source

pub const fn new(map: InlineScanMap<T, (), SZ>) -> Self

Creates a frozen set.

Source

pub fn get<Q>(&self, value: &Q) -> Option<&T>
where Q: ?Sized + Equivalent<T>,

Gets a reference to a value in the set.

Source

pub fn contains<Q>(&self, value: &Q) -> bool
where Q: ?Sized + Equivalent<T>,

Checks whether a particular value is present in the set.

Source

pub fn iter(&self) -> Iter<'_, T>

An iterator visiting all entries in arbitrary order.

Source

pub const fn len(&self) -> usize

Returns the number of elements in the collection.

Source

pub const fn is_empty(&self) -> bool

Returns true if the collection contains no elements.

Trait Implementations§

Source§

impl<T, ST, const SZ: usize> BitAnd<&ST> for &InlineScanSet<T, SZ>
where T: Hash + Eq + Clone, ST: Set<T>,

Source§

type Output = HashSet<T>

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

impl<T, ST, const SZ: usize> BitOr<&ST> for &InlineScanSet<T, SZ>
where T: Hash + Eq + Clone, ST: Set<T>,

Source§

type Output = HashSet<T>

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

impl<T, ST, const SZ: usize> BitXor<&ST> for &InlineScanSet<T, SZ>
where T: Hash + Eq + Clone, ST: Set<T>,

Source§

type Output = HashSet<T>

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

impl<T: Clone, const SZ: usize> Clone for InlineScanSet<T, SZ>

Source§

fn clone(&self) -> InlineScanSet<T, SZ>

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, const SZ: usize> Debug for InlineScanSet<T, SZ>
where T: Debug,

Source§

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

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

impl<'a, T, const SZ: usize> IntoIterator for &'a InlineScanSet<T, SZ>

Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T, const SZ: usize> IntoIterator for InlineScanSet<T, SZ>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T, const SZ: usize> Len for InlineScanSet<T, SZ>

Source§

fn len(&self) -> usize

Returns the number of elements in the collection.
Source§

fn is_empty(&self) -> bool

Returns true if the collection contains no elements.
Source§

impl<T, ST, const SZ: usize> PartialEq<ST> for InlineScanSet<T, SZ>
where T: PartialEq, ST: SetQuery<T>,

Source§

fn eq(&self, other: &ST) -> 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, const SZ: usize> Serialize for InlineScanSet<T, SZ>
where T: Serialize,

Available on crate feature serde only.
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<T, Q, const SZ: usize> SetExtras<T, Q> for InlineScanSet<T, SZ>
where Q: ?Sized + Equivalent<T>,

Source§

fn get(&self, value: &Q) -> Option<&T>

Gets a reference to a value in the set.
Source§

impl<T, const SZ: usize> SetIteration<T> for InlineScanSet<T, SZ>

Source§

type Iterator<'a> = Iter<'a, T> where T: 'a

The type of the iterator returned by Self::iter.
Source§

fn iter(&self) -> Self::Iterator<'_>

An iterator visiting all entries in arbitrary order.
Source§

impl<T, Q, const SZ: usize> SetQuery<Q> for InlineScanSet<T, SZ>
where Q: ?Sized + Equivalent<T>,

Source§

fn contains(&self, value: &Q) -> bool

Checks whether a particular value is present in the set.
Source§

impl<T, ST, const SZ: usize> Sub<&ST> for &InlineScanSet<T, SZ>
where T: Hash + Eq + Clone, ST: Set<T>,

Source§

type Output = HashSet<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &ST) -> Self::Output

Performs the - operation. Read more
Source§

impl<T, const SZ: usize> Eq for InlineScanSet<T, SZ>
where T: Eq,

Source§

impl<T, Q, const SZ: usize> Set<T, Q> for InlineScanSet<T, SZ>
where Q: ?Sized + Equivalent<T>,

Auto Trait Implementations§

§

impl<T, const SZ: usize> Freeze for InlineScanSet<T, SZ>
where T: Freeze,

§

impl<T, const SZ: usize> RefUnwindSafe for InlineScanSet<T, SZ>
where T: RefUnwindSafe,

§

impl<T, const SZ: usize> Send for InlineScanSet<T, SZ>
where T: Send,

§

impl<T, const SZ: usize> Sync for InlineScanSet<T, SZ>
where T: Sync,

§

impl<T, const SZ: usize> Unpin for InlineScanSet<T, SZ>
where T: Unpin,

§

impl<T, const SZ: usize> UnsafeUnpin for InlineScanSet<T, SZ>
where T: UnsafeUnpin,

§

impl<T, const SZ: usize> UnwindSafe for InlineScanSet<T, SZ>
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<Q, K> Equivalent<K> for Q
where 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 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<ST, T> SetOps<T> for ST
where ST: Set<T>,

Source§

fn union<'a, ST>(&'a self, other: &'a ST) -> Union<'a, Self, ST, T>
where ST: Set<T>, Self: Sized + Set<T>,

Visits the values representing the union, i.e., all the values in self or other, without duplicates.
Source§

fn symmetric_difference<'a, ST>( &'a self, other: &'a ST, ) -> SymmetricDifference<'a, Self, ST, T>
where ST: Set<T>, Self: Sized + Set<T>,

Visits the values representing the symmetric difference, i.e., the values that are in self or in other but not in both.
Source§

fn difference<'a, ST>(&'a self, other: &'a ST) -> Difference<'a, Self, ST, T>
where ST: Set<T>, Self: Sized + Set<T>,

Visits the values representing the difference, i.e., the values that are in self but not in other.
Source§

fn intersection<'a, ST>( &'a self, other: &'a ST, ) -> Intersection<'a, Self, ST, T>
where ST: Set<T>, Self: Sized + Set<T>,

Visits the values representing the intersection, i.e., the values that are both in self and other. Read more
Source§

fn is_disjoint<'a, ST>(&'a self, other: &'a ST) -> bool
where ST: Set<T>, Self: Sized + Set<T>,

Returns true if self has no entries in common with other. This is equivalent to checking for an empty intersection.
Source§

fn is_subset<'a, ST>(&'a self, other: &'a ST) -> bool
where ST: Set<T>, Self: Sized + Set<T>,

Returns true if the set is a subset of another, i.e., other contains at least all the values in self.
Source§

fn is_superset<'a, ST>(&'a self, other: &'a ST) -> bool
where ST: Set<T>, Self: Sized + Set<T>,

Returns true if the set is a superset of another, i.e., self contains at least all the values in other.
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, 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.