Struct otter_api_tests::crates::otter_support::prelude::SparseSecondaryMap
source · [−]pub struct SparseSecondaryMap<K, V, S = RandomState> where
K: Key,
S: BuildHasher, { /* private fields */ }
Expand description
Sparse secondary map, associate data with previously stored elements in a slot map.
A SparseSecondaryMap
allows you to efficiently store additional
information for each element in a slot map. You can have multiple secondary
maps per slot map, but not multiple slot maps per secondary map. It is safe
but unspecified behavior if you use keys from multiple different slot maps
in the same SparseSecondaryMap
.
A SparseSecondaryMap
does not leak memory even if you never remove
elements. In return, when you remove a key from the primary slot map, after
any insert the space associated with the removed element may be reclaimed.
Don’t expect the values associated with a removed key to stick around after
an insertion has happened!
Unlike SecondaryMap
, the SparseSecondaryMap
is backed by a
HashMap
. This means its access times are higher, but it uses less memory
and iterates faster if there are only a few elements of the slot map in the
secondary map. If most or all of the elements in a slot map are also found
in the secondary map, use a SecondaryMap
instead.
The current implementation of SparseSecondaryMap
requires std
and is
thus not available in no_std
environments.
Example usage:
let mut players = SlotMap::new();
let mut health = SparseSecondaryMap::new();
let mut ammo = SparseSecondaryMap::new();
let alice = players.insert("alice");
let bob = players.insert("bob");
for p in players.keys() {
health.insert(p, 100);
ammo.insert(p, 30);
}
// Alice attacks Bob with all her ammo!
health[bob] -= ammo[alice] * 3;
ammo[alice] = 0;
Implementations
sourceimpl<K, V> SparseSecondaryMap<K, V, RandomState> where
K: Key,
impl<K, V> SparseSecondaryMap<K, V, RandomState> where
K: Key,
sourcepub fn new() -> SparseSecondaryMap<K, V, RandomState>
pub fn new() -> SparseSecondaryMap<K, V, RandomState>
Constructs a new, empty SparseSecondaryMap
.
Examples
let mut sec: SparseSecondaryMap<DefaultKey, i32> = SparseSecondaryMap::new();
sourcepub fn with_capacity(capacity: usize) -> SparseSecondaryMap<K, V, RandomState>
pub fn with_capacity(capacity: usize) -> SparseSecondaryMap<K, V, RandomState>
Creates an empty SparseSecondaryMap
with the given capacity of slots.
The secondary map will not reallocate until it holds at least capacity
slots.
Examples
let mut sm: SlotMap<_, i32> = SlotMap::with_capacity(10);
let mut sec: SparseSecondaryMap<DefaultKey, i32> =
SparseSecondaryMap::with_capacity(sm.capacity());
sourceimpl<K, V, S> SparseSecondaryMap<K, V, S> where
K: Key,
S: BuildHasher,
impl<K, V, S> SparseSecondaryMap<K, V, S> where
K: Key,
S: BuildHasher,
sourcepub fn with_hasher(hash_builder: S) -> SparseSecondaryMap<K, V, S>
pub fn with_hasher(hash_builder: S) -> SparseSecondaryMap<K, V, S>
Creates an empty SparseSecondaryMap
which will use the given hash
builder to hash keys.
The secondary map will not reallocate until it holds at least capacity
slots.
Examples
let mut sm: SlotMap<_, i32> = SlotMap::with_capacity(10);
let mut sec: SparseSecondaryMap<DefaultKey, i32, _> =
SparseSecondaryMap::with_hasher(RandomState::new());
sourcepub fn with_capacity_and_hasher(
capacity: usize,
hash_builder: S
) -> SparseSecondaryMap<K, V, S>
pub fn with_capacity_and_hasher(
capacity: usize,
hash_builder: S
) -> SparseSecondaryMap<K, V, S>
Creates an empty SparseSecondaryMap
with the given capacity of slots,
using hash_builder
to hash the keys.
The secondary map will not reallocate until it holds at least capacity
slots.
Examples
let mut sm: SlotMap<_, i32> = SlotMap::with_capacity(10);
let mut sec: SparseSecondaryMap<DefaultKey, i32, _> =
SparseSecondaryMap::with_capacity_and_hasher(10, RandomState::new());
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of elements in the secondary map.
Examples
let mut sm = SlotMap::new();
let k = sm.insert(4);
let mut squared = SparseSecondaryMap::new();
assert_eq!(squared.len(), 0);
squared.insert(k, 16);
assert_eq!(squared.len(), 1);
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns if the secondary map is empty.
Examples
let mut sec: SparseSecondaryMap<DefaultKey, i32> = SparseSecondaryMap::new();
assert!(sec.is_empty());
sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of elements the SparseSecondaryMap
can hold without
reallocating.
Examples
let mut sec: SparseSecondaryMap<DefaultKey, i32> = SparseSecondaryMap::with_capacity(10);
assert!(sec.capacity() >= 10);
sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional
more slots in the
SparseSecondaryMap
. The collection may reserve more space to avoid
frequent reallocations.
Panics
Panics if the new allocation size overflows usize
.
Examples
let mut sec: SparseSecondaryMap<DefaultKey, i32> = SparseSecondaryMap::new();
sec.reserve(10);
assert!(sec.capacity() >= 10);
sourcepub fn contains_key(&self, key: K) -> bool
pub fn contains_key(&self, key: K) -> bool
sourcepub fn insert(&mut self, key: K, value: V) -> Option<V>
pub fn insert(&mut self, key: K, value: V) -> Option<V>
Inserts a value into the secondary map at the given key
. Can silently
fail if key
was removed from the originating slot map.
Returns None
if this key was not present in the map, the old value
otherwise.
Examples
let mut sm = SlotMap::new();
let k = sm.insert(4);
let mut squared = SparseSecondaryMap::new();
assert_eq!(squared.insert(k, 0), None);
assert_eq!(squared.insert(k, 4), Some(0));
// You don't have to use insert if the key is already in the secondary map.
squared[k] *= squared[k];
assert_eq!(squared[k], 16);
sourcepub fn remove(&mut self, key: K) -> Option<V>
pub fn remove(&mut self, key: K) -> Option<V>
Removes a key from the secondary map, returning the value at the key if
the key was not previously removed. If key
was removed from the
originating slot map, its corresponding entry in the secondary map may
or may not already be removed.
Examples
let mut sm = SlotMap::new();
let mut squared = SparseSecondaryMap::new();
let k = sm.insert(4);
squared.insert(k, 16);
squared.remove(k);
assert!(!squared.contains_key(k));
// It's not necessary to remove keys deleted from the primary slot map, they
// get deleted automatically when their slots are reused on a subsequent insert.
squared.insert(k, 16);
sm.remove(k); // Remove k from the slot map, making an empty slot.
let new_k = sm.insert(2); // Since sm only has one empty slot, this reuses it.
assert!(!squared.contains_key(new_k)); // Space reuse does not mean equal keys.
assert!(squared.contains_key(k)); // Slot has not been reused in squared yet.
squared.insert(new_k, 4);
assert!(!squared.contains_key(k)); // Old key is no longer available.
sourcepub fn retain<F>(&mut self, f: F) where
F: for<'_> FnMut(K, &mut V) -> bool,
pub fn retain<F>(&mut self, f: F) where
F: for<'_> FnMut(K, &mut V) -> bool,
Retains only the elements specified by the predicate.
In other words, remove all key-value pairs (k, v)
such that
f(k, &mut v)
returns false. This method invalidates any removed keys.
Examples
let mut sm = SlotMap::new();
let mut sec = SparseSecondaryMap::new();
let k1 = sm.insert(0); sec.insert(k1, 10);
let k2 = sm.insert(1); sec.insert(k2, 11);
let k3 = sm.insert(2); sec.insert(k3, 12);
sec.retain(|key, val| key == k1 || *val == 11);
assert!(sec.contains_key(k1));
assert!(sec.contains_key(k2));
assert!(!sec.contains_key(k3));
assert_eq!(2, sec.len());
sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears the secondary map. Keeps the allocated memory for reuse.
Examples
let mut sm = SlotMap::new();
let mut sec = SparseSecondaryMap::new();
for i in 0..10 {
sec.insert(sm.insert(i), i);
}
assert_eq!(sec.len(), 10);
sec.clear();
assert_eq!(sec.len(), 0);
sourcepub fn drain(&mut self) -> Drain<'_, K, V>ⓘNotable traits for Drain<'a, K, V>impl<'a, K, V> Iterator for Drain<'a, K, V> where
K: Key, type Item = (K, V);
pub fn drain(&mut self) -> Drain<'_, K, V>ⓘNotable traits for Drain<'a, K, V>impl<'a, K, V> Iterator for Drain<'a, K, V> where
K: Key, type Item = (K, V);
K: Key, type Item = (K, V);
Clears the slot map, returning all key-value pairs in arbitrary order as an iterator. Keeps the allocated memory for reuse.
When the iterator is dropped all elements in the slot map are removed,
even if the iterator was not fully consumed. If the iterator is not
dropped (using e.g. std::mem::forget
), only the elements that were
iterated over are removed.
Examples
let mut sm = SlotMap::new();
let k = sm.insert(0);
let mut sec = SparseSecondaryMap::new();
sec.insert(k, 1);
let v: Vec<_> = sec.drain().collect();
assert_eq!(sec.len(), 0);
assert_eq!(v, vec![(k, 1)]);
sourcepub fn get(&self, key: K) -> Option<&V>
pub fn get(&self, key: K) -> Option<&V>
Returns a reference to the value corresponding to the key.
Examples
let mut sm = SlotMap::new();
let key = sm.insert("foo");
let mut sec = SparseSecondaryMap::new();
sec.insert(key, "bar");
assert_eq!(sec.get(key), Some(&"bar"));
sec.remove(key);
assert_eq!(sec.get(key), None);
sourcepub fn get_mut(&mut self, key: K) -> Option<&mut V>
pub fn get_mut(&mut self, key: K) -> Option<&mut V>
Returns a mutable reference to the value corresponding to the key.
Examples
let mut sm = SlotMap::new();
let key = sm.insert("test");
let mut sec = SparseSecondaryMap::new();
sec.insert(key, 3.5);
if let Some(x) = sec.get_mut(key) {
*x += 3.0;
}
assert_eq!(sec[key], 6.5);
sourcepub fn iter(&self) -> Iter<'_, K, V>ⓘNotable traits for Iter<'a, K, V>impl<'a, K, V> Iterator for Iter<'a, K, V> where
K: Key, type Item = (K, &'a V);
pub fn iter(&self) -> Iter<'_, K, V>ⓘNotable traits for Iter<'a, K, V>impl<'a, K, V> Iterator for Iter<'a, K, V> where
K: Key, type Item = (K, &'a V);
K: Key, type Item = (K, &'a V);
An iterator visiting all key-value pairs in arbitrary order. The
iterator element type is (K, &'a V)
.
This function must iterate over all slots, empty or not. In the face of many deleted elements it can be inefficient.
Examples
let mut sm = SlotMap::new();
let mut sec = SparseSecondaryMap::new();
let k0 = sm.insert(0); sec.insert(k0, 10);
let k1 = sm.insert(1); sec.insert(k1, 11);
let k2 = sm.insert(2); sec.insert(k2, 12);
for (k, v) in sec.iter() {
println!("key: {:?}, val: {}", k, v);
}
sourcepub fn iter_mut(&mut self) -> IterMut<'_, K, V>ⓘNotable traits for IterMut<'a, K, V>impl<'a, K, V> Iterator for IterMut<'a, K, V> where
K: Key, type Item = (K, &'a mut V);
pub fn iter_mut(&mut self) -> IterMut<'_, K, V>ⓘNotable traits for IterMut<'a, K, V>impl<'a, K, V> Iterator for IterMut<'a, K, V> where
K: Key, type Item = (K, &'a mut V);
K: Key, type Item = (K, &'a mut V);
An iterator visiting all key-value pairs in arbitrary order, with
mutable references to the values. The iterator element type is
(K, &'a mut V)
.
This function must iterate over all slots, empty or not. In the face of many deleted elements it can be inefficient.
Examples
let mut sm = SlotMap::new();
let mut sec = SparseSecondaryMap::new();
let k0 = sm.insert(1); sec.insert(k0, 10);
let k1 = sm.insert(2); sec.insert(k1, 20);
let k2 = sm.insert(3); sec.insert(k2, 30);
for (k, v) in sec.iter_mut() {
if k != k1 {
*v *= -1;
}
}
assert_eq!(sec[k0], -10);
assert_eq!(sec[k1], 20);
assert_eq!(sec[k2], -30);
sourcepub fn keys(&self) -> Keys<'_, K, V>ⓘNotable traits for Keys<'a, K, V>impl<'a, K, V> Iterator for Keys<'a, K, V> where
K: Key, type Item = K;
pub fn keys(&self) -> Keys<'_, K, V>ⓘNotable traits for Keys<'a, K, V>impl<'a, K, V> Iterator for Keys<'a, K, V> where
K: Key, type Item = K;
K: Key, type Item = K;
An iterator visiting all keys in arbitrary order. The iterator element
type is K
.
This function must iterate over all slots, empty or not. In the face of many deleted elements it can be inefficient.
Examples
let mut sm = SlotMap::new();
let mut sec = SparseSecondaryMap::new();
let k0 = sm.insert(1); sec.insert(k0, 10);
let k1 = sm.insert(2); sec.insert(k1, 20);
let k2 = sm.insert(3); sec.insert(k2, 30);
let keys: HashSet<_> = sec.keys().collect();
let check: HashSet<_> = vec![k0, k1, k2].into_iter().collect();
assert_eq!(keys, check);
sourcepub fn values(&self) -> Values<'_, K, V>ⓘNotable traits for Values<'a, K, V>impl<'a, K, V> Iterator for Values<'a, K, V> where
K: Key, type Item = &'a V;
pub fn values(&self) -> Values<'_, K, V>ⓘNotable traits for Values<'a, K, V>impl<'a, K, V> Iterator for Values<'a, K, V> where
K: Key, type Item = &'a V;
K: Key, type Item = &'a V;
An iterator visiting all values in arbitrary order. The iterator element
type is &'a V
.
This function must iterate over all slots, empty or not. In the face of many deleted elements it can be inefficient.
Examples
let mut sm = SlotMap::new();
let mut sec = SparseSecondaryMap::new();
let k0 = sm.insert(1); sec.insert(k0, 10);
let k1 = sm.insert(2); sec.insert(k1, 20);
let k2 = sm.insert(3); sec.insert(k2, 30);
let values: HashSet<_> = sec.values().collect();
let check: HashSet<_> = vec![&10, &20, &30].into_iter().collect();
assert_eq!(values, check);
sourcepub fn values_mut(&mut self) -> ValuesMut<'_, K, V>ⓘNotable traits for ValuesMut<'a, K, V>impl<'a, K, V> Iterator for ValuesMut<'a, K, V> where
K: Key, type Item = &'a mut V;
pub fn values_mut(&mut self) -> ValuesMut<'_, K, V>ⓘNotable traits for ValuesMut<'a, K, V>impl<'a, K, V> Iterator for ValuesMut<'a, K, V> where
K: Key, type Item = &'a mut V;
K: Key, type Item = &'a mut V;
An iterator visiting all values mutably in arbitrary order. The iterator
element type is &'a mut V
.
This function must iterate over all slots, empty or not. In the face of many deleted elements it can be inefficient.
Examples
let mut sm = SlotMap::new();
let mut sec = SparseSecondaryMap::new();
sec.insert(sm.insert(1), 10);
sec.insert(sm.insert(2), 20);
sec.insert(sm.insert(3), 30);
sec.values_mut().for_each(|n| { *n *= 3 });
let values: HashSet<_> = sec.into_iter().map(|(_k, v)| v).collect();
let check: HashSet<_> = vec![30, 60, 90].into_iter().collect();
assert_eq!(values, check);
sourcepub fn entry(&mut self, key: K) -> Option<Entry<'_, K, V>>
pub fn entry(&mut self, key: K) -> Option<Entry<'_, K, V>>
Gets the given key’s corresponding Entry
in the map for in-place
manipulation. May return None
if the key was removed from the
originating slot map.
Examples
let mut sm = SlotMap::new();
let mut sec = SparseSecondaryMap::new();
let k = sm.insert(1);
let v = sec.entry(k).unwrap().or_insert(10);
assert_eq!(*v, 10);
Trait Implementations
sourceimpl<K, V, S> Clone for SparseSecondaryMap<K, V, S> where
K: Clone + Key,
V: Clone,
S: Clone + BuildHasher,
impl<K, V, S> Clone for SparseSecondaryMap<K, V, S> where
K: Clone + Key,
V: Clone,
S: Clone + BuildHasher,
sourcefn clone(&self) -> SparseSecondaryMap<K, V, S>
fn clone(&self) -> SparseSecondaryMap<K, V, S>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<K, V, S> Debug for SparseSecondaryMap<K, V, S> where
K: Debug + Key,
V: Debug,
S: Debug + BuildHasher,
impl<K, V, S> Debug for SparseSecondaryMap<K, V, S> where
K: Debug + Key,
V: Debug,
S: Debug + BuildHasher,
sourceimpl<K, V, S> Default for SparseSecondaryMap<K, V, S> where
K: Key,
S: BuildHasher + Default,
impl<K, V, S> Default for SparseSecondaryMap<K, V, S> where
K: Key,
S: BuildHasher + Default,
sourcefn default() -> SparseSecondaryMap<K, V, S>
fn default() -> SparseSecondaryMap<K, V, S>
Returns the “default value” for a type. Read more
sourceimpl<'de, K, V, S> Deserialize<'de> for SparseSecondaryMap<K, V, S> where
K: Key,
V: Deserialize<'de>,
S: BuildHasher + Default,
impl<'de, K, V, S> Deserialize<'de> for SparseSecondaryMap<K, V, S> where
K: Key,
V: Deserialize<'de>,
S: BuildHasher + Default,
sourcefn deserialize<D>(
deserializer: D
) -> Result<SparseSecondaryMap<K, V, S>, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<SparseSecondaryMap<K, V, S>, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<'a, K, V, S> Extend<(K, &'a V)> for SparseSecondaryMap<K, V, S> where
K: Key,
V: 'a + Copy,
S: BuildHasher,
impl<'a, K, V, S> Extend<(K, &'a V)> for SparseSecondaryMap<K, V, S> where
K: Key,
V: 'a + Copy,
S: BuildHasher,
sourcefn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = (K, &'a V)>,
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = (K, &'a V)>,
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl<K, V, S> Extend<(K, V)> for SparseSecondaryMap<K, V, S> where
K: Key,
S: BuildHasher,
impl<K, V, S> Extend<(K, V)> for SparseSecondaryMap<K, V, S> where
K: Key,
S: BuildHasher,
sourcefn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = (K, V)>,
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = (K, V)>,
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl<K, V, S> FromIterator<(K, V)> for SparseSecondaryMap<K, V, S> where
K: Key,
S: BuildHasher + Default,
impl<K, V, S> FromIterator<(K, V)> for SparseSecondaryMap<K, V, S> where
K: Key,
S: BuildHasher + Default,
sourcefn from_iter<I>(iter: I) -> SparseSecondaryMap<K, V, S> where
I: IntoIterator<Item = (K, V)>,
fn from_iter<I>(iter: I) -> SparseSecondaryMap<K, V, S> where
I: IntoIterator<Item = (K, V)>,
Creates a value from an iterator. Read more
sourceimpl<K, V, S> Index<K> for SparseSecondaryMap<K, V, S> where
K: Key,
S: BuildHasher,
impl<K, V, S> Index<K> for SparseSecondaryMap<K, V, S> where
K: Key,
S: BuildHasher,
sourceimpl<K, V, S> IndexMut<K> for SparseSecondaryMap<K, V, S> where
K: Key,
S: BuildHasher,
impl<K, V, S> IndexMut<K> for SparseSecondaryMap<K, V, S> where
K: Key,
S: BuildHasher,
sourceimpl<'a, K, V, S> IntoIterator for &'a mut SparseSecondaryMap<K, V, S> where
K: Key,
S: BuildHasher,
impl<'a, K, V, S> IntoIterator for &'a mut SparseSecondaryMap<K, V, S> where
K: Key,
S: BuildHasher,
sourcefn into_iter(
self
) -> <&'a mut SparseSecondaryMap<K, V, S> as IntoIterator>::IntoIter
fn into_iter(
self
) -> <&'a mut SparseSecondaryMap<K, V, S> as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
sourceimpl<'a, K, V, S> IntoIterator for &'a SparseSecondaryMap<K, V, S> where
K: Key,
S: BuildHasher,
impl<'a, K, V, S> IntoIterator for &'a SparseSecondaryMap<K, V, S> where
K: Key,
S: BuildHasher,
sourcefn into_iter(
self
) -> <&'a SparseSecondaryMap<K, V, S> as IntoIterator>::IntoIter
fn into_iter(
self
) -> <&'a SparseSecondaryMap<K, V, S> as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
sourceimpl<K, V, S> IntoIterator for SparseSecondaryMap<K, V, S> where
K: Key,
S: BuildHasher,
impl<K, V, S> IntoIterator for SparseSecondaryMap<K, V, S> where
K: Key,
S: BuildHasher,
sourcefn into_iter(self) -> <SparseSecondaryMap<K, V, S> as IntoIterator>::IntoIter
fn into_iter(self) -> <SparseSecondaryMap<K, V, S> as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
sourceimpl<K, V, S> PartialEq<SparseSecondaryMap<K, V, S>> for SparseSecondaryMap<K, V, S> where
K: Key,
V: PartialEq<V>,
S: BuildHasher,
impl<K, V, S> PartialEq<SparseSecondaryMap<K, V, S>> for SparseSecondaryMap<K, V, S> where
K: Key,
V: PartialEq<V>,
S: BuildHasher,
sourceimpl<K, V, H> Serialize for SparseSecondaryMap<K, V, H> where
K: Key,
V: Serialize,
H: BuildHasher,
impl<K, V, H> Serialize for SparseSecondaryMap<K, V, H> where
K: Key,
V: Serialize,
H: BuildHasher,
sourcefn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<K, V, S> Eq for SparseSecondaryMap<K, V, S> where
K: Key,
V: Eq,
S: BuildHasher,
Auto Trait Implementations
impl<K, V, S> RefUnwindSafe for SparseSecondaryMap<K, V, S> where
S: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V, S> Send for SparseSecondaryMap<K, V, S> where
S: Send,
V: Send,
impl<K, V, S> Sync for SparseSecondaryMap<K, V, S> where
S: Sync,
V: Sync,
impl<K, V, S> Unpin for SparseSecondaryMap<K, V, S> where
S: Unpin,
V: Unpin,
impl<K, V, S> UnwindSafe for SparseSecondaryMap<K, V, S> where
S: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<W, Global>impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<W, Global>impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
impl<A> DynCastExt for A
impl<A> DynCastExt for A
fn dyn_cast<T>(
self
) -> Result<<A as DynCastExtHelper<T>>::Target, <A as DynCastExtHelper<T>>::Source> where
A: DynCastExtHelper<T>,
T: ?Sized,
fn dyn_cast<T>(
self
) -> Result<<A as DynCastExtHelper<T>>::Target, <A as DynCastExtHelper<T>>::Source> where
A: DynCastExtHelper<T>,
T: ?Sized,
Use this to cast from one trait object type to another. Read more
fn dyn_upcast<T>(self) -> <A as DynCastExtAdvHelper<T, T>>::Target where
A: DynCastExtAdvHelper<T, T, Source = <A as DynCastExtAdvHelper<T, T>>::Target>,
T: ?Sized,
fn dyn_upcast<T>(self) -> <A as DynCastExtAdvHelper<T, T>>::Target where
A: DynCastExtAdvHelper<T, T, Source = <A as DynCastExtAdvHelper<T, T>>::Target>,
T: ?Sized,
Use this to upcast a trait to one of its supertraits. Read more
fn dyn_cast_adv<F, T>(
self
) -> Result<<A as DynCastExtAdvHelper<F, T>>::Target, <A as DynCastExtAdvHelper<F, T>>::Source> where
A: DynCastExtAdvHelper<F, T>,
F: ?Sized,
T: ?Sized,
fn dyn_cast_adv<F, T>(
self
) -> Result<<A as DynCastExtAdvHelper<F, T>>::Target, <A as DynCastExtAdvHelper<F, T>>::Source> where
A: DynCastExtAdvHelper<F, T>,
F: ?Sized,
T: ?Sized,
fn dyn_cast_with_config<C>(
self
) -> Result<<A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Target, <A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Source> where
C: DynCastConfig,
A: DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>,
fn dyn_cast_with_config<C>(
self
) -> Result<<A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Target, <A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Source> where
C: DynCastConfig,
A: DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>,
Use this to cast from one trait object type to another. With this method the type parameter is a config type that uniquely specifies which cast should be preformed. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourcefn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourceimpl<T> Serialize for T where
T: Serialize + ?Sized,
impl<T> Serialize for T where
T: Serialize + ?Sized,
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
T: Future, type Output = <T as Future>::Output;
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more