pub struct DashMap<K, V, S = RandomState> { /* private fields */ }
Expand description

DashMap is an implementation of a concurrent associative array/hashmap in Rust.

DashMap tries to implement an easy to use API similar to std::collections::HashMap with some slight changes to handle concurrency.

DashMap tries to be very simple to use and to be a direct replacement for RwLock<HashMap<K, V, S>>. To accomplish this, all methods take &self instead of modifying methods taking &mut self. This allows you to put a DashMap in an Arc<T> and share it between threads while being able to modify it.

Documentation mentioning locking behaviour acts in the reference frame of the calling thread. This means that it is safe to ignore it across multiple threads.

Implementations§

§

impl<'a, K, V> DashMap<K, V>where K: 'a + Eq + Hash, V: 'a,

pub fn new() -> DashMap<K, V>

Creates a new DashMap with a capacity of 0.

Examples
use dashmap::DashMap;

let reviews = DashMap::new();
reviews.insert("Veloren", "What a fantastic game!");

pub fn with_capacity(capacity: usize) -> DashMap<K, V>

Creates a new DashMap with a specified starting capacity.

Examples
use dashmap::DashMap;

let mappings = DashMap::with_capacity(2);
mappings.insert(2, 4);
mappings.insert(8, 16);

pub fn with_shard_amount(shard_amount: usize) -> DashMap<K, V>

Creates a new DashMap with a specified shard amount

shard_amount should greater than 0 and be a power of two. If a shard_amount which is not a power of two is provided, the function will panic.

Examples
use dashmap::DashMap;

let mappings = DashMap::with_shard_amount(32);
mappings.insert(2, 4);
mappings.insert(8, 16);

pub fn with_capacity_and_shard_amount( capacity: usize, shard_amount: usize ) -> DashMap<K, V>

Creates a new DashMap with a specified capacity and shard amount.

shard_amount should greater than 0 and be a power of two. If a shard_amount which is not a power of two is provided, the function will panic.

Examples
use dashmap::DashMap;

let mappings = DashMap::with_capacity_and_shard_amount(32, 32);
mappings.insert(2, 4);
mappings.insert(8, 16);
§

impl<'a, K, V, S> DashMap<K, V, S>where K: 'a + Eq + Hash, V: 'a, S: BuildHasher + Clone,

pub fn into_read_only(self) -> ReadOnlyView<K, V, S>

Wraps this DashMap into a read-only view. This view allows to obtain raw references to the stored values.

pub fn with_hasher(hasher: S) -> DashMap<K, V, S>

Creates a new DashMap with a capacity of 0 and the provided hasher.

Examples
use dashmap::DashMap;
use std::collections::hash_map::RandomState;

let s = RandomState::new();
let reviews = DashMap::with_hasher(s);
reviews.insert("Veloren", "What a fantastic game!");

pub fn with_capacity_and_hasher(capacity: usize, hasher: S) -> DashMap<K, V, S>

Creates a new DashMap with a specified starting capacity and hasher.

Examples
use dashmap::DashMap;
use std::collections::hash_map::RandomState;

let s = RandomState::new();
let mappings = DashMap::with_capacity_and_hasher(2, s);
mappings.insert(2, 4);
mappings.insert(8, 16);

pub fn with_hasher_and_shard_amount( hasher: S, shard_amount: usize ) -> DashMap<K, V, S>

Creates a new DashMap with a specified hasher and shard amount

shard_amount should be greater than 0 and a power of two. If a shard_amount which is not a power of two is provided, the function will panic.

Examples
use dashmap::DashMap;
use std::collections::hash_map::RandomState;

let s = RandomState::new();
let mappings = DashMap::with_hasher_and_shard_amount(s, 32);
mappings.insert(2, 4);
mappings.insert(8, 16);

pub fn with_capacity_and_hasher_and_shard_amount( capacity: usize, hasher: S, shard_amount: usize ) -> DashMap<K, V, S>

Creates a new DashMap with a specified starting capacity, hasher and shard_amount.

shard_amount should greater than 0 and be a power of two. If a shard_amount which is not a power of two is provided, the function will panic.

Examples
use dashmap::DashMap;
use std::collections::hash_map::RandomState;

let s = RandomState::new();
let mappings = DashMap::with_capacity_and_hasher_and_shard_amount(2, s, 32);
mappings.insert(2, 4);
mappings.insert(8, 16);

pub fn hash_usize<T>(&self, item: &T) -> usizewhere T: Hash,

Hash a given item to produce a usize. Uses the provided or default HashBuilder.

pub fn hasher(&self) -> &S

Returns a reference to the map’s BuildHasher.

Examples
use dashmap::DashMap;
use std::collections::hash_map::RandomState;

let hasher = RandomState::new();
let map: DashMap<i32, i32> = DashMap::new();
let hasher: &RandomState = map.hasher();

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

Inserts a key and a value into the map. Returns the old value associated with the key if there was one.

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

Examples
use dashmap::DashMap;

let map = DashMap::new();
map.insert("I am the key!", "And I am the value!");

pub fn remove<Q>(&self, key: &Q) -> Option<(K, V)>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Removes an entry from the map, returning the key and value if they existed in the map.

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

Examples
use dashmap::DashMap;

let soccer_team = DashMap::new();
soccer_team.insert("Jack", "Goalie");
assert_eq!(soccer_team.remove("Jack").unwrap().1, "Goalie");

pub fn remove_if<Q>( &self, key: &Q, f: impl FnOnce(&K, &V) -> bool ) -> Option<(K, V)>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Removes an entry from the map, returning the key and value if the entry existed and the provided conditional function returned true.

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

use dashmap::DashMap;

let soccer_team = DashMap::new();
soccer_team.insert("Sam", "Forward");
soccer_team.remove_if("Sam", |_, position| position == &"Goalie");
assert!(soccer_team.contains_key("Sam"));
use dashmap::DashMap;

let soccer_team = DashMap::new();
soccer_team.insert("Sam", "Forward");
soccer_team.remove_if("Sam", |_, position| position == &"Forward");
assert!(!soccer_team.contains_key("Sam"));

pub fn remove_if_mut<Q>( &self, key: &Q, f: impl FnOnce(&K, &mut V) -> bool ) -> Option<(K, V)>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

pub fn iter(&'a self) -> Iter<'a, K, V, S>

Creates an iterator over a DashMap yielding immutable references.

Locking behaviour: May deadlock if called when holding a mutable reference into the map.

Examples
use dashmap::DashMap;

let words = DashMap::new();
words.insert("hello", "world");
assert_eq!(words.iter().count(), 1);

pub fn iter_mut(&'a self) -> IterMut<'a, K, V, S>

Iterator over a DashMap yielding mutable references.

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

Examples
use dashmap::DashMap;

let map = DashMap::new();
map.insert("Johnny", 21);
map.iter_mut().for_each(|mut r| *r += 1);
assert_eq!(*map.get("Johnny").unwrap(), 22);

pub fn get<Q>(&'a self, key: &Q) -> Option<Ref<'a, K, V, S>>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Get an immutable reference to an entry in the map

Locking behaviour: May deadlock if called when holding a mutable reference into the map.

Examples
use dashmap::DashMap;

let youtubers = DashMap::new();
youtubers.insert("Bosnian Bill", 457000);
assert_eq!(*youtubers.get("Bosnian Bill").unwrap(), 457000);

pub fn get_mut<Q>(&'a self, key: &Q) -> Option<RefMut<'a, K, V, S>>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Get a mutable reference to an entry in the map

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

Examples
use dashmap::DashMap;

let class = DashMap::new();
class.insert("Albin", 15);
*class.get_mut("Albin").unwrap() -= 1;
assert_eq!(*class.get("Albin").unwrap(), 14);

pub fn try_get<Q>(&'a self, key: &Q) -> TryResult<Ref<'a, K, V, S>>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Get an immutable reference to an entry in the map, if the shard is not locked. If the shard is locked, the function will return TryResult::Locked.

Examples
use dashmap::DashMap;
use dashmap::try_result::TryResult;

let map = DashMap::new();
map.insert("Johnny", 21);

assert_eq!(*map.try_get("Johnny").unwrap(), 21);

let _result1_locking = map.get_mut("Johnny");

let result2 = map.try_get("Johnny");
assert!(result2.is_locked());

pub fn try_get_mut<Q>(&'a self, key: &Q) -> TryResult<RefMut<'a, K, V, S>>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Get a mutable reference to an entry in the map, if the shard is not locked. If the shard is locked, the function will return TryResult::Locked.

Examples
use dashmap::DashMap;
use dashmap::try_result::TryResult;

let map = DashMap::new();
map.insert("Johnny", 21);

*map.try_get_mut("Johnny").unwrap() += 1;
assert_eq!(*map.get("Johnny").unwrap(), 22);

let _result1_locking = map.get("Johnny");

let result2 = map.try_get_mut("Johnny");
assert!(result2.is_locked());

pub fn shrink_to_fit(&self)

Remove excess capacity to reduce memory usage.

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

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

Retain elements that whose predicates return true and discard elements whose predicates return false.

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

Examples
use dashmap::DashMap;

let people = DashMap::new();
people.insert("Albin", 15);
people.insert("Jones", 22);
people.insert("Charlie", 27);
people.retain(|_, v| *v > 20);
assert_eq!(people.len(), 2);

pub fn len(&self) -> usize

Fetches the total number of key-value pairs stored in the map.

Locking behaviour: May deadlock if called when holding a mutable reference into the map.

Examples
use dashmap::DashMap;

let people = DashMap::new();
people.insert("Albin", 15);
people.insert("Jones", 22);
people.insert("Charlie", 27);
assert_eq!(people.len(), 3);

pub fn is_empty(&self) -> bool

Checks if the map is empty or not.

Locking behaviour: May deadlock if called when holding a mutable reference into the map.

Examples
use dashmap::DashMap;

let map = DashMap::<(), ()>::new();
assert!(map.is_empty());

pub fn clear(&self)

Removes all key-value pairs in the map.

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

Examples
use dashmap::DashMap;

let stats = DashMap::new();
stats.insert("Goals", 4);
assert!(!stats.is_empty());
stats.clear();
assert!(stats.is_empty());

pub fn capacity(&self) -> usize

Returns how many key-value pairs the map can store without reallocating.

Locking behaviour: May deadlock if called when holding a mutable reference into the map.

pub fn alter<Q>(&self, key: &Q, f: impl FnOnce(&K, V) -> V)where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Modify a specific value according to a function.

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

Examples
use dashmap::DashMap;

let stats = DashMap::new();
stats.insert("Goals", 4);
stats.alter("Goals", |_, v| v * 2);
assert_eq!(*stats.get("Goals").unwrap(), 8);
Panics

If the given closure panics, then alter will abort the process

pub fn alter_all(&self, f: impl FnMut(&K, V) -> V)

Modify every value in the map according to a function.

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

Examples
use dashmap::DashMap;

let stats = DashMap::new();
stats.insert("Wins", 4);
stats.insert("Losses", 2);
stats.alter_all(|_, v| v + 1);
assert_eq!(*stats.get("Wins").unwrap(), 5);
assert_eq!(*stats.get("Losses").unwrap(), 3);
Panics

If the given closure panics, then alter_all will abort the process

pub fn view<Q, R>(&self, key: &Q, f: impl FnOnce(&K, &V) -> R) -> Option<R>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Scoped access into an item of the map according to a function.

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

Examples
use dashmap::DashMap;

let warehouse = DashMap::new();
warehouse.insert(4267, ("Banana", 100));
warehouse.insert(2359, ("Pear", 120));
let fruit = warehouse.view(&4267, |_k, v| *v);
assert_eq!(fruit, Some(("Banana", 100)));
Panics

If the given closure panics, then view will abort the process

pub fn contains_key<Q>(&self, key: &Q) -> boolwhere K: Borrow<Q>, Q: Hash + Eq + ?Sized,

Checks if the map contains a specific key.

Locking behaviour: May deadlock if called when holding a mutable reference into the map.

Examples
use dashmap::DashMap;

let team_sizes = DashMap::new();
team_sizes.insert("Dakota Cherries", 23);
assert!(team_sizes.contains_key("Dakota Cherries"));

pub fn entry(&'a self, key: K) -> Entry<'a, K, V, S>

Advanced entry API that tries to mimic std::collections::HashMap. See the documentation on dashmap::mapref::entry for more details.

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

pub fn try_entry(&'a self, key: K) -> Option<Entry<'a, K, V, S>>

Advanced entry API that tries to mimic std::collections::HashMap. See the documentation on dashmap::mapref::entry for more details.

Returns None if the shard is currently locked.

pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>

Advanced entry API that tries to mimic std::collections::HashMap::try_reserve. Tries to reserve capacity for at least shard * additional and may reserve more space to avoid frequent reallocations.

Errors

If the capacity overflows, or the allocator reports a failure, then an error is returned.

Trait Implementations§

§

impl<'a, K, V, S, Q> BitAnd<&Q> for &'a DashMap<K, V, S>where K: 'a + Eq + Hash + Borrow<Q>, V: 'a, S: BuildHasher + Clone, Q: Hash + Eq + ?Sized,

§

type Output = bool

The resulting type after applying the & operator.
§

fn bitand(self, key: &Q) -> <&'a DashMap<K, V, S> as BitAnd<&Q>>::Output

Performs the & operation. Read more
§

impl<'a, K, V, S, Q> BitOr<&Q> for &'a DashMap<K, V, S>where K: 'a + Eq + Hash + Borrow<Q>, V: 'a, S: BuildHasher + Clone, Q: Hash + Eq + ?Sized,

§

type Output = RefMut<'a, K, V, S>

The resulting type after applying the | operator.
§

fn bitor(self, key: &Q) -> <&'a DashMap<K, V, S> as BitOr<&Q>>::Output

Performs the | operation. Read more
§

impl<K, V, S> Clone for DashMap<K, V, S>where K: Eq + Hash + Clone, V: Clone, S: Clone,

§

fn clone(&self) -> DashMap<K, V, S>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
§

impl<K, V, S> Debug for DashMap<K, V, S>where K: Eq + Hash + Debug, V: Debug, S: BuildHasher + Clone,

§

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

Formats the value using the given formatter. Read more
§

impl<K, V, S> Default for DashMap<K, V, S>where K: Eq + Hash, S: Default + BuildHasher + Clone,

§

fn default() -> DashMap<K, V, S>

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

impl<K, V, S> Extend<(K, V)> for DashMap<K, V, S>where K: Eq + Hash, S: BuildHasher + Clone,

§

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

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

fn extend_one(&mut self, item: A)

🔬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
§

impl<K, V, S> FromIterator<(K, V)> for DashMap<K, V, S>where K: Eq + Hash, S: BuildHasher + Clone + Default,

§

fn from_iter<I>(intoiter: I) -> DashMap<K, V, S>where I: IntoIterator<Item = (K, V)>,

Creates a value from an iterator. Read more
§

impl<'a, K, V, S> IntoIterator for &'a DashMap<K, V, S>where K: Eq + Hash, S: BuildHasher + Clone,

§

type Item = RefMulti<'a, K, V, S>

The type of the elements being iterated over.
§

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

Which kind of iterator are we turning this into?
§

fn into_iter(self) -> <&'a DashMap<K, V, S> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
§

impl<K, V, S> IntoIterator for DashMap<K, V, S>where K: Eq + Hash, S: BuildHasher + Clone,

§

type Item = (K, V)

The type of the elements being iterated over.
§

type IntoIter = OwningIter<K, V, S>

Which kind of iterator are we turning this into?
§

fn into_iter(self) -> <DashMap<K, V, S> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
§

impl<'a, K, V, S> Map<'a, K, V, S> for DashMap<K, V, S>where K: 'a + Eq + Hash, V: 'a, S: 'a + BuildHasher + Clone,

§

fn _shard_count(&self) -> usize

§

unsafe fn _get_read_shard( &'a self, i: usize ) -> &'a HashMap<K, SharedValue<V>, S>

Safety Read more
§

unsafe fn _yield_read_shard( &'a self, i: usize ) -> RwLockReadGuard<'a, RawRwLock, HashMap<K, SharedValue<V>, S>>

Safety Read more
§

unsafe fn _yield_write_shard( &'a self, i: usize ) -> RwLockWriteGuard<'a, RawRwLock, HashMap<K, SharedValue<V>, S>>

Safety Read more
§

unsafe fn _try_yield_read_shard( &'a self, i: usize ) -> Option<RwLockReadGuard<'a, RawRwLock, HashMap<K, SharedValue<V>, S>>>

Safety Read more
§

unsafe fn _try_yield_write_shard( &'a self, i: usize ) -> Option<RwLockWriteGuard<'a, RawRwLock, HashMap<K, SharedValue<V>, S>>>

Safety Read more
§

fn _insert(&self, key: K, value: V) -> Option<V>

§

fn _remove<Q>(&self, key: &Q) -> Option<(K, V)>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

§

fn _remove_if<Q>( &self, key: &Q, f: impl FnOnce(&K, &V) -> bool ) -> Option<(K, V)>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

§

fn _remove_if_mut<Q>( &self, key: &Q, f: impl FnOnce(&K, &mut V) -> bool ) -> Option<(K, V)>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

§

fn _iter(&'a self) -> Iter<'a, K, V, S>

§

fn _iter_mut(&'a self) -> IterMut<'a, K, V, S>

§

fn _get<Q>(&'a self, key: &Q) -> Option<Ref<'a, K, V, S>>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

§

fn _get_mut<Q>(&'a self, key: &Q) -> Option<RefMut<'a, K, V, S>>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

§

fn _try_get<Q>(&'a self, key: &Q) -> TryResult<Ref<'a, K, V, S>>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

§

fn _try_get_mut<Q>(&'a self, key: &Q) -> TryResult<RefMut<'a, K, V, S>>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

§

fn _shrink_to_fit(&self)

§

fn _retain(&self, f: impl FnMut(&K, &mut V) -> bool)

§

fn _len(&self) -> usize

§

fn _capacity(&self) -> usize

§

fn _alter<Q>(&self, key: &Q, f: impl FnOnce(&K, V) -> V)where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

§

fn _alter_all(&self, f: impl FnMut(&K, V) -> V)

§

fn _view<Q, R>(&self, key: &Q, f: impl FnOnce(&K, &V) -> R) -> Option<R>where K: Borrow<Q>, Q: Hash + Eq + ?Sized,

§

fn _entry(&'a self, key: K) -> Entry<'a, K, V, S>

§

fn _try_entry(&'a self, key: K) -> Option<Entry<'a, K, V, S>>

§

fn _hasher(&self) -> S

§

fn _clear(&self)

§

fn _contains_key<Q>(&'a self, key: &Q) -> boolwhere K: Borrow<Q>, Q: Hash + Eq + ?Sized,

§

fn _is_empty(&self) -> bool

§

impl<'a, K, V, S> Shl<(K, V)> for &'a DashMap<K, V, S>where K: 'a + Eq + Hash, V: 'a, S: BuildHasher + Clone,

§

type Output = Option<V>

The resulting type after applying the << operator.
§

fn shl(self, pair: (K, V)) -> <&'a DashMap<K, V, S> as Shl<(K, V)>>::Output

Performs the << operation. Read more
§

impl<'a, K, V, S, Q> Shr<&Q> for &'a DashMap<K, V, S>where K: 'a + Eq + Hash + Borrow<Q>, V: 'a, S: BuildHasher + Clone, Q: Hash + Eq + ?Sized,

§

type Output = Ref<'a, K, V, S>

The resulting type after applying the >> operator.
§

fn shr(self, key: &Q) -> <&'a DashMap<K, V, S> as Shr<&Q>>::Output

Performs the >> operation. Read more
§

impl<K> ShrinkableKeyedStateStore<K> for DashMap<K, InMemoryState>where K: Hash + Eq + Clone,

§

fn retain_recent(&self, drop_below: Nanos)

Remove those keys with state older than drop_below.
§

fn shrink_to_fit(&self)

Shrinks the capacity of the state store, if possible. Read more
§

fn len(&self) -> usize

Returns the number of “live” keys stored in the state store. Read more
§

fn is_empty(&self) -> bool

Returns true if self has no keys stored in it. Read more
§

impl<K> StateStore for DashMap<K, InMemoryState>where K: Hash + Eq + Clone,

§

type Key = K

The type of key that the state store can represent.
§

fn measure_and_replace<T, F, E>( &self, key: &<DashMap<K, InMemoryState> as StateStore>::Key, f: F ) -> Result<T, E>where F: Fn(Option<Nanos>) -> Result<(T, Nanos), E>,

Updates a state store’s rate limiting state for a given key, using the given closure. Read more
§

impl<'a, K, V, S, Q> Sub<&Q> for &'a DashMap<K, V, S>where K: 'a + Eq + Hash + Borrow<Q>, V: 'a, S: BuildHasher + Clone, Q: Hash + Eq + ?Sized,

§

type Output = Option<(K, V)>

The resulting type after applying the - operator.
§

fn sub(self, key: &Q) -> <&'a DashMap<K, V, S> as Sub<&Q>>::Output

Performs the - operation. Read more

Auto Trait Implementations§

§

impl<K, V, S = RandomState> !RefUnwindSafe for DashMap<K, V, S>

§

impl<K, V, S> Send for DashMap<K, V, S>where K: Send, S: Send, V: Send,

§

impl<K, V, S> Sync for DashMap<K, V, S>where K: Send + Sync, S: Send + Sync, V: Send + Sync,

§

impl<K, V, S> Unpin for DashMap<K, V, S>where S: Unpin,

§

impl<K, V, S> UnwindSafe for DashMap<K, V, S>where K: UnwindSafe, S: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> Twhere Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

source§

impl<T> FromWorld for Twhere T: Default,

source§

fn from_world(_world: &World) -> T

Creates Self using data from the given World.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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.

§

impl<F, T> IntoSample<T> for Fwhere T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T> Pipe for Twhere T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> Rwhere Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R ) -> Rwhere Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> RawClone for Twhere T: Clone,

§

unsafe fn raw_clone(src: *const c_void, dst: *mut c_void)

Write the default value of the type to the pointer. Read more
§

fn raw_clone_cb( ) -> Unsafe<&'static (dyn Fn(*const c_void, *mut c_void) + Send + Sync)>

Get a callback suitable for [SchemaData].
§

impl<T> RawDefault for Twhere T: Default,

§

unsafe fn raw_default(dst: *mut c_void)

Write the default value of the type to the pointer. Read more
§

fn raw_default_cb() -> Unsafe<&'static (dyn Fn(*mut c_void) + Send + Sync)>

Get a callback suitable for [SchemaData].
§

impl<T> RawDrop for T

§

unsafe fn raw_drop(ptr: *mut c_void)

Write the default value of the type to the pointer. Read more
§

fn raw_drop_cb() -> Unsafe<&'static (dyn Fn(*mut c_void) + Send + Sync)>

Get a callback suitable for [SchemaData].
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<'gc, T> Singleton<'gc> for Twhere T: Default,

§

fn create(_: Context<'gc>) -> T

§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
source§

impl<T> ToOwned for Twhere T: Clone,

§

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
§

impl<T, U> ToSample<U> for Twhere U: FromSample<T>,

§

fn to_sample_(self) -> U

§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<S, T> Duplex<S> for Twhere T: FromSample<S> + ToSample<S>,

§

impl<T, K> KeyedStateStore<K> for Twhere K: Hash + Eq + Clone, T: StateStore<Key = K>,

§

impl<T> SerializableAny for Twhere T: 'static + Any + Clone + for<'a> Send + Sync,