Skip to main content

PagedSparseMap

Struct PagedSparseMap 

Source
pub struct PagedSparseMap<K, V, const PAGE: usize = DEFAULT_PAGE, D: Directory = Flat> { /* private fields */ }
Expand description

A map from Keys to values with O(1) insert, remove and lookup, and contiguous arrays of its keys and values.

PAGE and D are as for PagedSparseSet: slots per page of the sparse index, and the page directory (Flat by default, Radix for wide keys, or Tree). See crate::page.

Entries are kept in insertion order until a removal, which moves the last entry into the gap. See the module docs for how methods treat a slot held by another generation of a key.

Implementations§

Source§

impl<K: Key, V, const PAGE: usize, D: Directory> PagedSparseMap<K, V, PAGE, D>

Source

pub fn par_keys(&self) -> Iter<'_, K>
where K: Sync,

Available on crate feature rayon only.

Iterates in parallel over the keys in dense order.

Source

pub fn par_values(&self) -> Iter<'_, V>
where V: Sync,

Available on crate feature rayon only.

Iterates in parallel over the values in dense order.

Source

pub fn par_values_mut(&mut self) -> IterMut<'_, V>
where V: Send,

Available on crate feature rayon only.

Iterates in parallel over mutable values in dense order.

Source§

impl<K: Key, V, const PAGE: usize, D: Directory> PagedSparseMap<K, V, PAGE, D>

Source

pub const PAGE_SIZE: usize = PAGE

Number of slots per page of the sparse index.

Source

pub fn new() -> Self

Creates an empty map. No memory is allocated until the first insert.

Source

pub fn with_capacity(capacity: usize) -> Self

Creates an empty map whose dense arrays can hold capacity entries without reallocating. Pages are still allocated on demand.

Source

pub fn len(&self) -> usize

Number of entries in the map.

Source

pub fn is_empty(&self) -> bool

Whether the map has no entries.

Source

pub fn capacity(&self) -> usize

Number of entries the dense arrays can hold without reallocating.

Source

pub fn allocated_pages(&self) -> usize

Number of allocated pages in the sparse index.

Source

pub fn reserve(&mut self, additional: usize)

Reserves room in the dense arrays for at least additional more entries.

Source

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. On error, one of the arrays may have grown.

Source

pub fn as_set(&self) -> &PagedSparseSet<K, PAGE, D>

The keys as a set.

Gives read access to the set’s lookups, such as occupant.

Source

pub fn position(&self, key: K) -> Option<usize>

Dense position of key, if it is in the map.

Positions index key_slice and value_slice, and change when entries are removed or the map is sorted.

Source

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

Whether key is in the map.

Source

pub fn get(&self, key: K) -> Option<&V>

The value for key, if it is in the map.

Source

pub fn get_mut(&mut self, key: K) -> Option<&mut V>

Mutable access to the value for key, if it is in the map.

Source

pub fn get_key_value(&self, key: K) -> Option<(&K, &V)>

The stored key equal to key and its value, if it is in the map.

Source

pub fn occupant(&self, index: usize) -> Option<(&K, &V)>

The entry occupying slot index, if any.

With generational keys this finds whichever generation is present.

Source

pub fn occupant_mut(&mut self, index: usize) -> Option<(&K, &mut V)>

The entry occupying slot index, with mutable access to its value.

Source

pub fn insert(&mut self, key: K, value: V) -> Option<V>

Stores value for key and returns the value previously in key’s slot.

If key is present its value is replaced and the key is kept. If the slot is held by a different key (another generation), that entry is evicted and its value returned; use replace to get the evicted key too, or try_insert to refuse.

§Panics

Panics if the map already holds u32::MAX entries, or if a page, the directory or a dense array cannot be allocated. The entries are then unchanged, though capacity or allocated pages may have grown.

Source

pub fn replace(&mut self, key: K, value: V) -> Option<(K, V)>

Stores value for key and returns the entry previously in key’s slot, whether it was key itself or another generation.

The new entry, key included, takes the old entry’s dense position. Unlike insert, this stores key even when the old key is equal to it.

§Panics

As insert.

Source

pub fn try_insert(&mut self, key: K, value: V) -> Result<&mut V, V>

Adds an entry if key’s slot is vacant and returns its value, or returns value back and leaves the map unchanged if the slot is held (by key or by another key with the same index).

§Panics

As insert.

Source

pub fn get_or_insert_with(&mut self, key: K, make: impl FnOnce() -> V) -> &mut V

The value for key, inserting make() first if key is absent.

If the slot is held by a different key, that entry is evicted, as by insert. make runs before the map changes, so if it panics the entries are unchanged.

§Panics

As insert.

Source

pub fn entry(&mut self, key: K) -> Entry<'_, K, V, PAGE, D>

The entry for key, for in-place access or insertion.

Entry::Occupied holds the exact stored key. If another generation holds the slot, this returns Entry::Vacant. Inserting through it evicts that generation and keeps its dense position, as insert does.

§Examples
use paged_collections::sparse_map::PagedSparseMap;

let mut counts: PagedSparseMap<usize, u32> = PagedSparseMap::new();
for key in [3, 1, 3, 3] {
    counts.entry(key).and_modify(|n| *n += 1).or_insert(1);
}
assert_eq!((counts[3], counts[1]), (3, 1));
Source

pub fn remove(&mut self, key: K) -> Option<V>

Removes key and returns its value, if it was present.

The last entry moves into the removed entry’s position.

Source

pub fn remove_entry(&mut self, key: K) -> Option<(K, V)>

Removes key and returns the stored key and its value, if it was present.

Source

pub fn remove_occupant(&mut self, index: usize) -> Option<(K, V)>

Removes whichever entry occupies slot index and returns it.

Source

pub fn retain(&mut self, keep: impl FnMut(&K, &mut V) -> bool)

Keeps only the entries for which keep returns true.

keep is called once per entry. Kept entries may change position. If keep or a value’s drop panics, the entries not yet visited are kept and the map stays consistent.

Source

pub fn clear(&mut self)

Removes every entry. The sparse index is cleared in O(1); the values are dropped.

Pages stay allocated for reuse; use reset to free them.

Source

pub fn reset(&mut self)

Removes every entry and frees every page. The dense arrays keep their capacity.

Source

pub fn shrink_to_fit(&mut self)

Shrinks the dense arrays and the page directory. Frees every page if the map is empty.

Source

pub fn key_slice(&self) -> &[K]

The keys as a slice, in dense order.

Source

pub fn value_slice(&self) -> &[V]

The values as a slice, in dense order: value_slice()[i] belongs to key_slice()[i].

Source

pub fn value_slice_mut(&mut self) -> &mut [V]

The values as a mutable slice, in dense order.

Source

pub fn keys(&self) -> Iter<'_, K> ⓘ

Iterates over the keys in dense order.

Source

pub fn values(&self) -> Iter<'_, V> ⓘ

Iterates over the values in dense order.

Source

pub fn values_mut(&mut self) -> IterMut<'_, V> ⓘ

Iterates mutably over the values in dense order.

Source

pub fn iter(&self) -> Iter<'_, K, V> ⓘ

Iterates over the entries in dense order.

Source

pub fn iter_mut(&mut self) -> IterMut<'_, K, V> ⓘ

Iterates over the entries in dense order, with mutable access to the values.

Source

pub fn drain(&mut self) -> Drain<'_, K, V> ⓘ

Removes every entry and returns them in dense order.

The map is empty as soon as this returns, even if the iterator is leaked; dropping it drops the entries not yet yielded. Pages and the dense arrays’ capacity are kept, as with clear.

use paged_collections::sparse_map::PagedSparseMap;

let mut map: PagedSparseMap<u32, char> = [(5, 'a'), (1, 'b')].into_iter().collect();
assert_eq!(map.drain().collect::<Vec<_>>(), [(5, 'a'), (1, 'b')]);
assert!(map.is_empty() && map.get(5).is_none());
Source

pub fn extract_if<F: FnMut(&K, &mut V) -> bool>( &mut self, pred: F, ) -> ExtractIf<'_, K, V, F, PAGE, D> ⓘ

Removes the entries for which pred returns true and yields them.

Each entry is tested exactly once. A removal moves the last entry into the gap, so entries are tested in dense order except that a moved entry is tested next. Entries not yet tested when the iterator is dropped stay in the map; use retain if the removed entries are not needed.

use paged_collections::sparse_map::PagedSparseMap;

let mut map: PagedSparseMap<u32, u32> = (0..6).map(|k| (k, k * 10)).collect();
let mut big: Vec<(u32, u32)> = map.extract_if(|_, v| *v >= 30).collect();
big.sort();
assert_eq!(big, [(3, 30), (4, 40), (5, 50)]);
assert_eq!(map.len(), 3);
Source

pub fn get_disjoint_mut<const N: usize>( &mut self, keys: [K; N], ) -> [Option<&mut V>; N]

The values of several keys at once, mutably: None for each key that is not in the map. O(N log N) for N keys.

use paged_collections::sparse_map::PagedSparseMap;

let mut map: PagedSparseMap<u32, u32> = [(1, 10), (2, 20)].into_iter().collect();
if let [Some(a), Some(b), None] = map.get_disjoint_mut([1, 2, 3]) {
    core::mem::swap(a, b);
}
assert_eq!((map[1], map[2]), (20, 10));
§Panics

Panics if a key in the map is given twice.

Source

pub fn range(&self, keys: impl RangeBounds<K>) -> Range<'_, K, V, PAGE, D> ⓘ

Iterates over the entries 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(entries yielded).

use paged_collections::sparse_map::PagedSparseMap;

let map: PagedSparseMap<u32, char, 4> =
    [(9, 'c'), (2, 'a'), (30, 'd'), (5, 'b')].into_iter().collect();
let keys: Vec<u32> = map.range(3..).map(|(&k, _)| k).collect();
assert_eq!(keys, [5, 9, 30]);
assert_eq!(map.first_key_value(), Some((&2, &'a')));
assert_eq!(map.prev_occupant(8), Some((&5, &'b')));
Source

pub fn first_key_value(&self) -> Option<(&K, &V)>

The entry with the smallest slot index. Costs as range.

Source

pub fn last_key_value(&self) -> Option<(&K, &V)>

The entry with the largest slot index. Costs as range.

Source

pub fn next_occupant(&self, index: usize) -> Option<(&K, &V)>

The entry at slot index or the first one after it.

Source

pub fn prev_occupant(&self, index: usize) -> Option<(&K, &V)>

The entry at slot index or the last one before it.

Source

pub fn pop_first(&mut self) -> Option<(K, V)>

Removes and returns the entry with the smallest slot index.

Source

pub fn pop_last(&mut self) -> Option<(K, V)>

Removes and returns the entry with the largest slot index.

Source

pub fn into_keys(self) -> IntoIter<K> ⓘ

Consumes the map and returns its keys in dense order.

Source

pub fn into_values(self) -> IntoIter<V> ⓘ

Consumes the map and returns its values in dense order.

Source

pub fn sort_by(&mut self, compare: impl FnMut((&K, &V), (&K, &V)) -> Ordering)

Sorts the entries by compare, keeping the order of equal entries, and updates the index.

If compare panics, the dense order and the key-value pairing are unchanged (values that compare changed through interior mutability stay changed).

Source

pub fn sort_by_key<T: Ord>(&mut self, f: impl FnMut(&K, &V) -> T)

Sorts the entries by a key function, keeping the order of entries with equal sort keys, and updates the index.

f may be called more than once per entry. If it panics, the dense order and the key-value pairing are unchanged.

Source

pub fn sort_by_cached_key<T: Ord>(&mut self, f: impl FnMut(&K, &V) -> T)

Sorts the entries by a key function that is called at most once per entry (not at all when there is nothing to compare), keeping the order of entries with equal sort keys, and updates the index. Use it when f is expensive.

If f panics, the dense order and the key-value pairing are unchanged.

Source

pub fn sort_keys(&mut self)
where K: Ord,

Sorts the entries by key in ascending order, keeping the order of entries with equal keys, and updates the index.

Stable, which matters only if equal keys can be told apart; prefer sort_unstable_keys otherwise.

Source

pub fn binary_search_key(&self, key: &K) -> Result<usize, usize>
where K: Ord,

Binary searches the dense order for key, which must be sorted by key in ascending order (as after sort_unstable_keys).

Returns Ok with the dense position of an entry whose key equals key, or Err with the position where such an entry would keep the order. If the entries are not sorted the result is unspecified.

For an exact lookup position is O(1); this is for the neighbours of a key that may be absent: the entries before the returned position have smaller keys, those from it on have keys at least as large.

Source

pub fn binary_search_by( &self, compare: impl FnMut(&K, &V) -> Ordering, ) -> Result<usize, usize>

Binary searches the dense order with a comparator, as [T]::binary_search_by: compare returns the ordering of an entry relative to the target. The entries must be sorted consistently with it; otherwise the result is unspecified.

Source

pub fn partition_point(&self, pred: impl FnMut(&K, &V) -> bool) -> usize

The dense position of the first entry for which pred is false, assuming the entries are partitioned: pred holds for a prefix and for nothing after it. As [T]::partition_point.

Source

pub fn sort_unstable_by( &mut self, compare: impl FnMut((&K, &V), (&K, &V)) -> Ordering, )

Sorts the entries by compare (unstable) and updates the index.

If compare panics, the dense order and the key-value pairing are unchanged (values that compare changed through interior mutability stay changed).

Source

pub fn sort_unstable_by_key<T: Ord>(&mut self, f: impl FnMut(&K, &V) -> T)

Sorts the entries by a key function (unstable) and updates the index.

f may be called more than once per entry. If it panics, the dense order and the key-value pairing are unchanged.

Source

pub fn sort_unstable_keys(&mut self)
where K: Ord,

Sorts the entries by key in ascending order (unstable) and updates the index.

Trait Implementations§

Source§

impl<K: Key, V: Clone, const PAGE: usize, D: Directory> Clone for PagedSparseMap<K, V, PAGE, D>
where D::Store<Slot, PAGE>: Clone,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<K: Key + Debug, V: Debug, const PAGE: usize, D: Directory> Debug for PagedSparseMap<K, V, PAGE, D>

Source§

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

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

impl<K: Key, V, const PAGE: usize, D: Directory> Default for PagedSparseMap<K, V, PAGE, D>

Source§

fn default() -> Self

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

impl<'de, K, V, const PAGE: usize, D> Deserialize<'de> for PagedSparseMap<K, V, PAGE, D>
where K: Key + Deserialize<'de>, V: Deserialize<'de>, D: Directory,

Available on crate feature serde only.

Deserializes from a map. Entries are inserted in input order with insert, so a later entry overwrites an earlier one in the same slot, as HashMap keeps the last duplicate.

Memory follows the key indices, not the input length: see the warning on PagedSparseSet’s Deserialize impl. For untrusted input, use Radix or Tree, or validate the keys first.

Source§

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

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

impl<K: Key, V: Eq, const PAGE: usize, D: Directory> Eq for PagedSparseMap<K, V, PAGE, D>

Map PartialEq is an equivalence relation when the values implement Eq.

Source§

impl<'a, K: Key + 'a, V: Copy + 'a, const PAGE: usize, D: Directory> Extend<(&'a K, &'a V)> for PagedSparseMap<K, V, PAGE, D>

Source§

fn extend<I: IntoIterator<Item = (&'a K, &'a V)>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: T)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<K: Key, V, const PAGE: usize, D: Directory> Extend<(K, V)> for PagedSparseMap<K, V, PAGE, D>

Inserts each entry with insert, so later entries overwrite earlier ones in the same slot.

Source§

fn extend<I: IntoIterator<Item = (K, V)>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: T)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<K: Key, V, const PAGE: usize, D: SharedDirectory> From<PagedSparseMap<K, V, PAGE, D>> for ConcurrentSparseMap<K, V, PAGE, D>

Available on crate feature concurrent only.
Source§

fn from(inner: PagedSparseMap<K, V, PAGE, D>) -> Self

Converts to this type from the input type.
Source§

impl<K: Key, V, const PAGE: usize, D: Directory> FromIterator<(K, V)> for PagedSparseMap<K, V, PAGE, D>

Source§

fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<K: Key + Hash, V: Hash, const PAGE: usize, D: Directory> Hash for PagedSparseMap<K, V, PAGE, D>

Hashes the key-value pairs in any order, consistent with PartialEq.

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<K: Key, V, const PAGE: usize, D: Directory> Index<K> for PagedSparseMap<K, V, PAGE, D>

map[key] returns the value for key.

§Panics

Panics if key is not in the map.

Source§

type Output = V

The returned type after indexing.
Source§

fn index(&self, key: K) -> &V

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a, K: Key, V, const PAGE: usize, D: Directory> IntoIterator for &'a PagedSparseMap<K, V, PAGE, D>

Source§

type Item = (&'a K, &'a V)

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, K, V>

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<'a, K: Key, V, const PAGE: usize, D: Directory> IntoIterator for &'a mut PagedSparseMap<K, V, PAGE, D>

Source§

type Item = (&'a K, &'a mut V)

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'a, K, V>

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<K: Key, V, const PAGE: usize, D: Directory> IntoIterator for PagedSparseMap<K, V, PAGE, D>

Source§

type Item = (K, V)

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<K, V>

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<'a, K: Key + Sync, V: Sync, const PAGE: usize, D: Directory> IntoParallelIterator for &'a PagedSparseMap<K, V, PAGE, D>

Available on crate feature rayon only.
Source§

type Item = (&'a K, &'a V)

The type of item that the parallel iterator will produce.
Source§

type Iter = Zip<Iter<'a, K>, Iter<'a, V>>

The parallel iterator type that will be created.
Source§

fn into_par_iter(self) -> Self::Iter

Converts self into a parallel iterator. Read more
Source§

impl<'a, K: Key + Sync, V: Send, const PAGE: usize, D: Directory> IntoParallelIterator for &'a mut PagedSparseMap<K, V, PAGE, D>

Available on crate feature rayon only.
Source§

type Item = (&'a K, &'a mut V)

The type of item that the parallel iterator will produce.
Source§

type Iter = Zip<Iter<'a, K>, IterMut<'a, V>>

The parallel iterator type that will be created.
Source§

fn into_par_iter(self) -> Self::Iter

Converts self into a parallel iterator. Read more
Source§

impl<K: Key, V: PartialEq<W>, W, const PAGE: usize, D: Directory, const P2: usize, D2: Directory> PartialEq<PagedSparseMap<K, W, P2, D2>> for PagedSparseMap<K, V, PAGE, D>

Compares values by exact key using get, in any order and across page sizes and directories.

Source§

fn eq(&self, other: &PagedSparseMap<K, W, P2, D2>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<K: Key + Serialize, V: Serialize, const PAGE: usize, D: Directory> Serialize for PagedSparseMap<K, V, PAGE, D>

Available on crate feature serde only.

Serializes as a map from keys to values, in dense order.

Source§

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

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<K, V, const PAGE: usize, D> Forget for PagedSparseMap<K, V, PAGE, D>

§

impl<K, V, const PAGE: usize, D> Freeze for PagedSparseMap<K, V, PAGE, D>
where PagedSparseSet<K, PAGE, D>: Freeze, Vec<V>: Freeze,

§

impl<K, V, const PAGE: usize, D> Move for PagedSparseMap<K, V, PAGE, D>

§

impl<K, V, const PAGE: usize, D> RefUnwindSafe for PagedSparseMap<K, V, PAGE, D>

§

impl<K, V, const PAGE: usize, D> Send for PagedSparseMap<K, V, PAGE, D>
where PagedSparseSet<K, PAGE, D>: Send, Vec<V>: Send,

§

impl<K, V, const PAGE: usize, D> Sync for PagedSparseMap<K, V, PAGE, D>
where PagedSparseSet<K, PAGE, D>: Sync, Vec<V>: Sync,

§

impl<K, V, const PAGE: usize, D> Unpin for PagedSparseMap<K, V, PAGE, D>
where PagedSparseSet<K, PAGE, D>: Unpin, Vec<V>: Unpin,

§

impl<K, V, const PAGE: usize, D> UnsafeUnpin for PagedSparseMap<K, V, PAGE, D>
where PagedSparseSet<K, PAGE, D>: UnsafeUnpin, Vec<V>: UnsafeUnpin,

§

impl<K, V, const PAGE: usize, D> UnwindSafe for PagedSparseMap<K, V, PAGE, D>
where PagedSparseSet<K, PAGE, D>: UnwindSafe, Vec<V>: 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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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<'data, I> IntoParallelRefIterator<'data> for I
where I: 'data + ?Sized, &'data I: IntoParallelIterator,

Source§

type Iter = <&'data I as IntoParallelIterator>::Iter

The type of the parallel iterator that will be returned.
Source§

type Item = <&'data I as IntoParallelIterator>::Item

The type of item that the parallel iterator will produce. This will typically be an &'data T reference type.
Source§

fn par_iter(&'data self) -> <I as IntoParallelRefIterator<'data>>::Iter

Converts self into a parallel iterator. Read more
Source§

impl<'data, I> IntoParallelRefMutIterator<'data> for I

Source§

type Iter = <&'data mut I as IntoParallelIterator>::Iter

The type of iterator that will be created.
Source§

type Item = <&'data mut I as IntoParallelIterator>::Item

The type of item that will be produced; this is typically an &'data mut T reference.
Source§

fn par_iter_mut( &'data mut self, ) -> <I as IntoParallelRefMutIterator<'data>>::Iter

Creates the parallel iterator from self. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.