pub struct PagedSparseSet<K, const PAGE: usize = DEFAULT_PAGE, D: Directory = Flat> { /* private fields */ }Expand description
A set of Keys with O(1) insert, remove and lookup, and a contiguous
array of its keys.
PAGEis the number of slots per page of the sparse index; it must be non-zero. SeeDEFAULT_PAGE.Dpicks the page directory:Flat(default) for dense keys,Radixfor keys spread over the 64-bit range, orTree. Seecrate::page.
The set holds at most one key per slot index. With plain integer keys that
is the usual set semantics. With generational keys, insert refuses a
key whose slot is held by another generation, and replace overwrites
it.
Keys are kept in insertion order until a removal, which moves the last key into the gap.
§Set operations
union, intersection,
difference, and
symmetric_difference iterate over borrowed
keys. The corresponding operators |, &, -, and ^ on borrowed sets
create a set with the left operand’s page size and directory. The assignment
operators |=, &=, -=, and ^= update a set in place. Removals can
reorder keys by moving the last key into each gap.
is_disjoint, is_subset, and
is_superset test relationships between sets.
use paged_collections::page::Radix;
use paged_collections::sparse_set::PagedSparseSet;
let mut a: PagedSparseSet<u16, 4> = [1, 2].into_iter().collect();
let b: PagedSparseSet<u16, 64, Radix> = [2, 3].into_iter().collect();
assert_eq!((&a | &b).as_slice(), &[1, 2, 3]);
a &= &b;
assert!(a.is_subset(&b));Implementations§
Source§impl<K: Key, const PAGE: usize, D: Directory> PagedSparseSet<K, PAGE, D>
impl<K: Key, const PAGE: usize, D: Directory> PagedSparseSet<K, PAGE, D>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates an empty set whose dense array can hold capacity keys
without reallocating. Pages are still allocated on demand.
Sourcepub fn allocated_pages(&self) -> usize
pub fn allocated_pages(&self) -> usize
Number of allocated pages in the sparse index.
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves room in the dense array for at least additional more keys.
Sourcepub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>
Like reserve, but returns an error instead of
panicking or aborting when the capacity overflows or the allocation
fails.
Sourcepub fn position(&self, key: K) -> Option<usize>
pub fn position(&self, key: K) -> Option<usize>
Dense position of key, if it is in the set.
Positions index as_slice and change when keys are
removed or the set is sorted.
Sourcepub fn get(&self, key: K) -> Option<&K>
pub fn get(&self, key: K) -> Option<&K>
The stored key equal to key, including its generation.
§Examples
use paged_collections::sparse_set::PagedSparseSet;
let mut set: PagedSparseSet<usize> = PagedSparseSet::new();
set.insert(7);
assert_eq!(set.get(7), Some(&7));
assert_eq!(set.get(8), None);Sourcepub fn occupant(&self, index: usize) -> Option<&K>
pub fn occupant(&self, index: usize) -> Option<&K>
The key occupying slot index, if any.
With generational keys this finds whichever generation is present.
Sourcepub fn insert(&mut self, key: K) -> bool
pub fn insert(&mut self, key: K) -> bool
Adds key and returns true, or returns false and leaves the set
unchanged if its slot is already held (by key or by another key with
the same index).
§Panics
Panics if the set already holds u32::MAX keys, or if a page or the
directory cannot be allocated.
Sourcepub fn remove(&mut self, key: K) -> bool
pub fn remove(&mut self, key: K) -> bool
Removes key and returns whether it was present.
The last key moves into the removed key’s position.
Sourcepub fn take(&mut self, key: K) -> Option<K>
pub fn take(&mut self, key: K) -> Option<K>
Removes and returns the stored key equal to key, including its
generation. The last key moves into the removed key’s position.
§Examples
use paged_collections::sparse_set::PagedSparseSet;
let mut set: PagedSparseSet<usize> = PagedSparseSet::new();
set.insert(7);
assert_eq!(set.take(7), Some(7));
assert_eq!(set.take(7), None);Sourcepub fn remove_occupant(&mut self, index: usize) -> Option<K>
pub fn remove_occupant(&mut self, index: usize) -> Option<K>
Removes whichever key occupies slot index and returns it.
Sourcepub fn retain(&mut self, keep: impl FnMut(&K) -> bool)
pub fn retain(&mut self, keep: impl FnMut(&K) -> bool)
Keeps only the keys for which keep returns true.
keep is called once per key. Kept keys may change position.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Removes every key in O(1).
Pages stay allocated for reuse; use reset to free
them.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Removes every key and frees every page. The dense array keeps its capacity.
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the dense array and the page directory. Frees every page if the set is empty.
Sourcepub fn drain(&mut self) -> Drain<'_, K> ⓘ
pub fn drain(&mut self) -> Drain<'_, K> ⓘ
Removes every key and returns them in dense order.
The set is empty as soon as this returns, even if the iterator is
leaked; dropping it drops the keys not yet yielded. Pages and the
dense array’s capacity are kept, as with clear.
use paged_collections::sparse_set::PagedSparseSet;
let mut set: PagedSparseSet<u32> = [5, 1, 9].into_iter().collect();
assert_eq!(set.drain().collect::<Vec<_>>(), [5, 1, 9]);
assert!(set.is_empty() && !set.contains(5));Sourcepub fn extract_if<F: FnMut(&K) -> bool>(
&mut self,
pred: F,
) -> ExtractIf<'_, K, F, PAGE, D> ⓘ
pub fn extract_if<F: FnMut(&K) -> bool>( &mut self, pred: F, ) -> ExtractIf<'_, K, F, PAGE, D> ⓘ
Removes the keys for which pred returns true and yields them.
Each key is tested exactly once. A removal moves the last key into
the gap, so keys are tested in dense order except that a moved key
is tested next. Keys not yet tested when the iterator is dropped stay
in the set; use retain if the removed keys are not
needed.
use paged_collections::sparse_set::PagedSparseSet;
let mut set: PagedSparseSet<u32> = (0..6).collect();
let mut odd: Vec<u32> = set.extract_if(|&k| k % 2 == 1).collect();
odd.sort();
assert_eq!(odd, [1, 3, 5]);
assert_eq!(set.len(), 3);Sourcepub fn range(&self, keys: impl RangeBounds<K>) -> Range<'_, K, PAGE, D> ⓘ
pub fn range(&self, keys: impl RangeBounds<K>) -> Range<'_, K, PAGE, D> ⓘ
Iterates over the keys whose slot index lies between the slot indices of the bounds, in slot-index order.
The bounds are keys, compared by Key::index: for plain integer
keys this is the usual key range, independent of dense order. A
generational key bounds by its index only. An empty or inverted range
yields nothing.
This walks the sparse index: it costs O(pages and slots in the
range), including slots left stale by clear (which
reset frees), not O(keys yielded).
use paged_collections::sparse_set::PagedSparseSet;
let set: PagedSparseSet<u32, 4> = [9, 2, 30, 5].into_iter().collect();
assert_eq!(set.range(3..=30).copied().collect::<Vec<_>>(), [5, 9, 30]);
assert_eq!((set.first(), set.last()), (Some(&2), Some(&30)));
assert_eq!(set.next_occupant(6), Some(&9));Sourcepub fn next_occupant(&self, index: usize) -> Option<&K>
pub fn next_occupant(&self, index: usize) -> Option<&K>
The key at slot index or the first one after it.
Sourcepub fn prev_occupant(&self, index: usize) -> Option<&K>
pub fn prev_occupant(&self, index: usize) -> Option<&K>
The key at slot index or the last one before it.
Sourcepub fn pop_first(&mut self) -> Option<K>
pub fn pop_first(&mut self) -> Option<K>
Removes and returns the key with the smallest slot index.
Sourcepub fn pop_last(&mut self) -> Option<K>
pub fn pop_last(&mut self) -> Option<K>
Removes and returns the key with the largest slot index.
Sourcepub fn difference<'a, const P2: usize, D2: Directory>(
&'a self,
other: &'a PagedSparseSet<K, P2, D2>,
) -> Difference<'a, K, P2, D2> ⓘ
pub fn difference<'a, const P2: usize, D2: Directory>( &'a self, other: &'a PagedSparseSet<K, P2, D2>, ) -> Difference<'a, K, P2, D2> ⓘ
Iterates over keys in self absent from other, in self’s dense order.
use paged_collections::sparse_set::PagedSparseSet;
let a: PagedSparseSet<u16> = [3, 1, 2].into_iter().collect();
let b: PagedSparseSet<u16> = [1, 4].into_iter().collect();
assert!(a.difference(&b).copied().eq([3, 2]));Sourcepub fn intersection<'a, const P2: usize, D2: Directory>(
&'a self,
other: &'a PagedSparseSet<K, P2, D2>,
) -> Intersection<'a, K, PAGE, D, P2, D2> ⓘ
pub fn intersection<'a, const P2: usize, D2: Directory>( &'a self, other: &'a PagedSparseSet<K, P2, D2>, ) -> Intersection<'a, K, PAGE, D, P2, D2> ⓘ
Iterates over keys present in both sets.
Order follows the smaller set’s dense order, or self’s dense order
if the sets contain the same number of keys.
use paged_collections::sparse_set::PagedSparseSet;
let a: PagedSparseSet<u16> = [1, 2, 3].into_iter().collect();
let b: PagedSparseSet<u16> = [2, 1].into_iter().collect();
assert!(a.intersection(&b).copied().eq([2, 1]));Sourcepub fn symmetric_difference<'a, const P2: usize, D2: Directory>(
&'a self,
other: &'a PagedSparseSet<K, P2, D2>,
) -> SymmetricDifference<'a, K, PAGE, D, P2, D2> ⓘ
pub fn symmetric_difference<'a, const P2: usize, D2: Directory>( &'a self, other: &'a PagedSparseSet<K, P2, D2>, ) -> SymmetricDifference<'a, K, PAGE, D, P2, D2> ⓘ
Iterates over keys present in exactly one set.
Yields self.difference(other), then
other.difference(self). Different generations of the same slot are
unequal, so both are yielded. Collecting into a PagedSparseSet keeps
self’s key because insert refuses an occupied slot.
use paged_collections::sparse_set::PagedSparseSet;
let a: PagedSparseSet<u16> = [3, 1, 2].into_iter().collect();
let b: PagedSparseSet<u16> = [2, 5, 4].into_iter().collect();
assert!(a.symmetric_difference(&b).copied().eq([3, 1, 5, 4]));Sourcepub fn union<'a, const P2: usize, D2: Directory>(
&'a self,
other: &'a PagedSparseSet<K, P2, D2>,
) -> Union<'a, K, PAGE, D> ⓘ
pub fn union<'a, const P2: usize, D2: Directory>( &'a self, other: &'a PagedSparseSet<K, P2, D2>, ) -> Union<'a, K, PAGE, D> ⓘ
Iterates over keys present in either set.
Yields self’s keys in dense order, then other.difference(self).
Different generations of the same slot are unequal, so both are
yielded. Collecting into a PagedSparseSet keeps self’s key because
insert refuses an occupied slot.
use paged_collections::sparse_set::PagedSparseSet;
let a: PagedSparseSet<u16> = [3, 1, 2].into_iter().collect();
let b: PagedSparseSet<u16> = [2, 5, 4].into_iter().collect();
assert!(a.union(&b).copied().eq([3, 1, 2, 5, 4]));Sourcepub fn is_disjoint<const P2: usize, D2: Directory>(
&self,
other: &PagedSparseSet<K, P2, D2>,
) -> bool
pub fn is_disjoint<const P2: usize, D2: Directory>( &self, other: &PagedSparseSet<K, P2, D2>, ) -> bool
Whether the sets have no keys in common. Iterates over the smaller set.
use paged_collections::sparse_set::PagedSparseSet;
let a: PagedSparseSet<u16> = [1, 2].into_iter().collect();
let b: PagedSparseSet<u16> = [3].into_iter().collect();
assert!(a.is_disjoint(&b));Sourcepub fn is_subset<const P2: usize, D2: Directory>(
&self,
other: &PagedSparseSet<K, P2, D2>,
) -> bool
pub fn is_subset<const P2: usize, D2: Directory>( &self, other: &PagedSparseSet<K, P2, D2>, ) -> bool
Whether every key in self is also in other.
use paged_collections::sparse_set::PagedSparseSet;
let a: PagedSparseSet<u16> = [2].into_iter().collect();
let b: PagedSparseSet<u16> = [1, 2].into_iter().collect();
assert!(a.is_subset(&b));Sourcepub fn is_superset<const P2: usize, D2: Directory>(
&self,
other: &PagedSparseSet<K, P2, D2>,
) -> bool
pub fn is_superset<const P2: usize, D2: Directory>( &self, other: &PagedSparseSet<K, P2, D2>, ) -> bool
Whether every key in other is also in self.
use paged_collections::sparse_set::PagedSparseSet;
let a: PagedSparseSet<u16> = [1, 2].into_iter().collect();
let b: PagedSparseSet<u16> = [2].into_iter().collect();
assert!(a.is_superset(&b));Sourcepub fn sort_by(&mut self, compare: impl FnMut(&K, &K) -> Ordering)
pub fn sort_by(&mut self, compare: impl FnMut(&K, &K) -> Ordering)
Sorts the dense array by compare, keeping the order of equal keys,
and updates the index.
If compare panics, the keys are left in an unspecified order but the
set stays consistent.
Sourcepub fn sort_by_key<T: Ord>(&mut self, f: impl FnMut(&K) -> T)
pub fn sort_by_key<T: Ord>(&mut self, f: impl FnMut(&K) -> T)
Sorts the dense array by a key function, keeping the order of keys with equal sort keys, and updates the index.
If f panics, the keys are left in an unspecified order but the set
stays consistent.
Sourcepub fn sort(&mut self)where
K: Ord,
pub fn sort(&mut self)where
K: Ord,
Sorts the dense array in ascending order and updates the index.
Stable, which matters only if equal keys can be told apart; prefer
sort_unstable otherwise: it allocates nothing.
Sourcepub fn sort_unstable_by(&mut self, compare: impl FnMut(&K, &K) -> Ordering)
pub fn sort_unstable_by(&mut self, compare: impl FnMut(&K, &K) -> Ordering)
Sorts the dense array by compare (unstable) and updates the index.
If compare panics, the keys are left in an unspecified order but the
set stays consistent.
Sourcepub fn sort_unstable_by_key<T: Ord>(&mut self, f: impl FnMut(&K) -> T)
pub fn sort_unstable_by_key<T: Ord>(&mut self, f: impl FnMut(&K) -> T)
Sorts the dense array by a key function (unstable) and updates the index.
If f panics, the keys are left in an unspecified order but the set
stays consistent.
Sourcepub fn sort_unstable(&mut self)where
K: Ord,
pub fn sort_unstable(&mut self)where
K: Ord,
Sorts the dense array in ascending order (unstable) and updates the index.
Trait Implementations§
Source§impl<K: Key, const PAGE: usize, D: Directory, const P2: usize, D2: Directory> BitAnd<&PagedSparseSet<K, P2, D2>> for &PagedSparseSet<K, PAGE, D>
Collects the intersection into a new set.
impl<K: Key, const PAGE: usize, D: Directory, const P2: usize, D2: Directory> BitAnd<&PagedSparseSet<K, P2, D2>> for &PagedSparseSet<K, PAGE, D>
Collects the intersection into a new set.
Source§type Output = PagedSparseSet<K, PAGE, D>
type Output = PagedSparseSet<K, PAGE, D>
& operator.Source§impl<K: Key, const PAGE: usize, D: Directory, const P2: usize, D2: Directory> BitAndAssign<&PagedSparseSet<K, P2, D2>> for PagedSparseSet<K, PAGE, D>
Keeps the keys present in both sets. Swap removal can reorder keys.
impl<K: Key, const PAGE: usize, D: Directory, const P2: usize, D2: Directory> BitAndAssign<&PagedSparseSet<K, P2, D2>> for PagedSparseSet<K, PAGE, D>
Keeps the keys present in both sets. Swap removal can reorder keys.
Source§fn bitand_assign(&mut self, other: &PagedSparseSet<K, P2, D2>)
fn bitand_assign(&mut self, other: &PagedSparseSet<K, P2, D2>)
&= operation. Read moreSource§impl<K: Key, const PAGE: usize, D: Directory, const P2: usize, D2: Directory> BitOr<&PagedSparseSet<K, P2, D2>> for &PagedSparseSet<K, PAGE, D>
Collects the union into a new set.
impl<K: Key, const PAGE: usize, D: Directory, const P2: usize, D2: Directory> BitOr<&PagedSparseSet<K, P2, D2>> for &PagedSparseSet<K, PAGE, D>
Collects the union into a new set.
Source§type Output = PagedSparseSet<K, PAGE, D>
type Output = PagedSparseSet<K, PAGE, D>
| operator.Source§impl<K: Key, const PAGE: usize, D: Directory, const P2: usize, D2: Directory> BitOrAssign<&PagedSparseSet<K, P2, D2>> for PagedSparseSet<K, PAGE, D>
Inserts the right operand’s keys in dense order, keeping occupied slots.
impl<K: Key, const PAGE: usize, D: Directory, const P2: usize, D2: Directory> BitOrAssign<&PagedSparseSet<K, P2, D2>> for PagedSparseSet<K, PAGE, D>
Inserts the right operand’s keys in dense order, keeping occupied slots.
Source§fn bitor_assign(&mut self, other: &PagedSparseSet<K, P2, D2>)
fn bitor_assign(&mut self, other: &PagedSparseSet<K, P2, D2>)
|= operation. Read moreSource§impl<K: Key, const PAGE: usize, D: Directory, const P2: usize, D2: Directory> BitXor<&PagedSparseSet<K, P2, D2>> for &PagedSparseSet<K, PAGE, D>
Collects the symmetric difference into a new set.
impl<K: Key, const PAGE: usize, D: Directory, const P2: usize, D2: Directory> BitXor<&PagedSparseSet<K, P2, D2>> for &PagedSparseSet<K, PAGE, D>
Collects the symmetric difference into a new set.
Source§type Output = PagedSparseSet<K, PAGE, D>
type Output = PagedSparseSet<K, PAGE, D>
^ operator.Source§impl<K: Key, const PAGE: usize, D: Directory, const P2: usize, D2: Directory> BitXorAssign<&PagedSparseSet<K, P2, D2>> for PagedSparseSet<K, PAGE, D>
Toggles each key in the right operand. Swap removal can reorder keys.
When the operands hold different generations of the same slot, the left
operand keeps its key and skips the right operand’s key.
impl<K: Key, const PAGE: usize, D: Directory, const P2: usize, D2: Directory> BitXorAssign<&PagedSparseSet<K, P2, D2>> for PagedSparseSet<K, PAGE, D>
Toggles each key in the right operand. Swap removal can reorder keys. When the operands hold different generations of the same slot, the left operand keeps its key and skips the right operand’s key.
Source§fn bitxor_assign(&mut self, other: &PagedSparseSet<K, P2, D2>)
fn bitxor_assign(&mut self, other: &PagedSparseSet<K, P2, D2>)
^= operation. Read moreSource§impl<'de, K: Key + Deserialize<'de>, const PAGE: usize, D: Directory> Deserialize<'de> for PagedSparseSet<K, PAGE, D>
Available on crate feature serde only.Deserializes from a sequence of keys. A key whose slot is already
taken is skipped, as HashSet skips duplicates.
impl<'de, K: Key + Deserialize<'de>, const PAGE: usize, D: Directory> Deserialize<'de> for PagedSparseSet<K, PAGE, D>
serde only.Deserializes from a sequence of keys. A key whose slot is already
taken is skipped, as HashSet skips duplicates.
Memory follows the key indices, not the input length: with the
Flat directory one large index allocates a directory entry for
every page below it, and an index near usize::MAX panics. For
untrusted input, use Radix or
Tree, or validate the keys first.
Source§fn deserialize<De: Deserializer<'de>>(
deserializer: De,
) -> Result<Self, De::Error>
fn deserialize<De: Deserializer<'de>>( deserializer: De, ) -> Result<Self, De::Error>
impl<K: Key, const PAGE: usize, D: Directory> Eq for PagedSparseSet<K, PAGE, D>
Exact key equality gives sets an equivalence relation under PartialEq.
Source§impl<'a, K: Key + 'a, const PAGE: usize, D: Directory> Extend<&'a K> for PagedSparseSet<K, PAGE, D>
impl<'a, K: Key + 'a, const PAGE: usize, D: Directory> Extend<&'a K> for PagedSparseSet<K, PAGE, D>
Source§fn extend<I: IntoIterator<Item = &'a K>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = &'a K>>(&mut self, iter: I)
Source§fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl<K: Key, const PAGE: usize, D: Directory> Extend<K> for PagedSparseSet<K, PAGE, D>
impl<K: Key, const PAGE: usize, D: Directory> Extend<K> for PagedSparseSet<K, PAGE, D>
Source§fn extend<I: IntoIterator<Item = K>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = K>>(&mut self, iter: I)
Source§fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl<K: Key, const PAGE: usize, D: SharedDirectory> From<PagedSparseSet<K, PAGE, D>> for ConcurrentSparseSet<K, PAGE, D>
Available on crate feature concurrent only.
impl<K: Key, const PAGE: usize, D: SharedDirectory> From<PagedSparseSet<K, PAGE, D>> for ConcurrentSparseSet<K, PAGE, D>
concurrent only.Source§fn from(inner: PagedSparseSet<K, PAGE, D>) -> Self
fn from(inner: PagedSparseSet<K, PAGE, D>) -> Self
Source§impl<K: Key, const PAGE: usize, D: Directory> FromIterator<K> for PagedSparseSet<K, PAGE, D>
impl<K: Key, const PAGE: usize, D: Directory> FromIterator<K> for PagedSparseSet<K, PAGE, D>
Source§fn from_iter<I: IntoIterator<Item = K>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = K>>(iter: I) -> Self
Source§impl<K: Key + Hash, const PAGE: usize, D: Directory> Hash for PagedSparseSet<K, PAGE, D>
Hashes the keys in any order, consistent with PartialEq.
impl<K: Key + Hash, const PAGE: usize, D: Directory> Hash for PagedSparseSet<K, PAGE, D>
Hashes the keys in any order, consistent with PartialEq.
Source§impl<'a, K: Key, const PAGE: usize, D: Directory> IntoIterator for &'a PagedSparseSet<K, PAGE, D>
impl<'a, K: Key, const PAGE: usize, D: Directory> IntoIterator for &'a PagedSparseSet<K, PAGE, D>
Source§impl<K: Key, const PAGE: usize, D: Directory> IntoIterator for PagedSparseSet<K, PAGE, D>
impl<K: Key, const PAGE: usize, D: Directory> IntoIterator for PagedSparseSet<K, PAGE, D>
Source§impl<'a, K: Key + Sync, const PAGE: usize, D: Directory> IntoParallelIterator for &'a PagedSparseSet<K, PAGE, D>
Available on crate feature rayon only.
impl<'a, K: Key + Sync, const PAGE: usize, D: Directory> IntoParallelIterator for &'a PagedSparseSet<K, PAGE, D>
rayon only.Source§impl<K: Key, const PAGE: usize, D: Directory, const P2: usize, D2: Directory> PartialEq<PagedSparseSet<K, P2, D2>> for PagedSparseSet<K, PAGE, D>
Compares exact keys with contains, in any
order and across page sizes and directories.
impl<K: Key, const PAGE: usize, D: Directory, const P2: usize, D2: Directory> PartialEq<PagedSparseSet<K, P2, D2>> for PagedSparseSet<K, PAGE, D>
Compares exact keys with contains, in any
order and across page sizes and directories.
Source§impl<K: Key + Serialize, const PAGE: usize, D: Directory> Serialize for PagedSparseSet<K, PAGE, D>
Available on crate feature serde only.Serializes as a sequence of keys in dense order.
impl<K: Key + Serialize, const PAGE: usize, D: Directory> Serialize for PagedSparseSet<K, PAGE, D>
serde only.Serializes as a sequence of keys in dense order.
Source§impl<K: Key, const PAGE: usize, D: Directory, const P2: usize, D2: Directory> Sub<&PagedSparseSet<K, P2, D2>> for &PagedSparseSet<K, PAGE, D>
Collects the difference into a new set.
impl<K: Key, const PAGE: usize, D: Directory, const P2: usize, D2: Directory> Sub<&PagedSparseSet<K, P2, D2>> for &PagedSparseSet<K, PAGE, D>
Collects the difference into a new set.
Source§type Output = PagedSparseSet<K, PAGE, D>
type Output = PagedSparseSet<K, PAGE, D>
- operator.Source§impl<K: Key, const PAGE: usize, D: Directory, const P2: usize, D2: Directory> SubAssign<&PagedSparseSet<K, P2, D2>> for PagedSparseSet<K, PAGE, D>
Removes keys present in the right operand. Swap removal can reorder keys.
impl<K: Key, const PAGE: usize, D: Directory, const P2: usize, D2: Directory> SubAssign<&PagedSparseSet<K, P2, D2>> for PagedSparseSet<K, PAGE, D>
Removes keys present in the right operand. Swap removal can reorder keys.
Source§fn sub_assign(&mut self, other: &PagedSparseSet<K, P2, D2>)
fn sub_assign(&mut self, other: &PagedSparseSet<K, P2, D2>)
-= operation. Read moreAuto Trait Implementations§
impl<K, const PAGE: usize, D> Forget for PagedSparseSet<K, PAGE, D>
impl<K, const PAGE: usize, D> Freeze for PagedSparseSet<K, PAGE, D>
impl<K, const PAGE: usize, D> Move for PagedSparseSet<K, PAGE, D>
impl<K, const PAGE: usize, D> RefUnwindSafe for PagedSparseSet<K, PAGE, D>
impl<K, const PAGE: usize, D> Send for PagedSparseSet<K, PAGE, D>
impl<K, const PAGE: usize, D> Sync for PagedSparseSet<K, PAGE, D>
impl<K, const PAGE: usize, D> Unpin for PagedSparseSet<K, PAGE, D>
impl<K, const PAGE: usize, D> UnsafeUnpin for PagedSparseSet<K, PAGE, D>
impl<K, const PAGE: usize, D> UnwindSafe for PagedSparseSet<K, PAGE, D>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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