Struct CHashMap
pub struct CHashMap<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>
impl<'a, K, V> DashMap<K, V>
pub fn new() -> DashMap<K, V>
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>
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>
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>
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>
impl<'a, K, V, S> DashMap<K, V, S>
pub fn into_read_only(self) -> ReadOnlyView<K, V, S>
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>
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>
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>
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>
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,
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 shards(&self) -> &[RwLock<RawRwLock, HashMap<K, SharedValue<V>, S>>]
pub fn shards(&self) -> &[RwLock<RawRwLock, HashMap<K, SharedValue<V>, S>>]
Allows you to peek at the inner shards that store your data. You should probably not use this unless you know what you are doing.
Requires the raw-api
feature to be enabled.
§Examples
use dashmap::DashMap;
let map = DashMap::<(), ()>::new();
println!("Amount of shards: {}", map.shards().len());
pub fn shards_mut(
&mut self,
) -> &mut [RwLock<RawRwLock, HashMap<K, SharedValue<V>, S>>]
pub fn shards_mut( &mut self, ) -> &mut [RwLock<RawRwLock, HashMap<K, SharedValue<V>, S>>]
Provides mutable access to the inner shards that store your data. You should probably not use this unless you know what you are doing.
Requires the raw-api
feature to be enabled.
§Examples
use dashmap::DashMap;
use dashmap::SharedValue;
let mut map = DashMap::<i32, &'static str>::new();
let shard_ind = map.determine_map(&42);
map.shards_mut()[shard_ind].get_mut().insert(42, SharedValue::new("forty two"));
assert_eq!(*map.get(&42).unwrap(), "forty two");
pub fn into_shards(
self,
) -> Box<[RwLock<RawRwLock, HashMap<K, SharedValue<V>, S>>]>
pub fn into_shards( self, ) -> Box<[RwLock<RawRwLock, HashMap<K, SharedValue<V>, S>>]>
Consumes this DashMap
and returns the inner shards.
You should probably not use this unless you know what you are doing.
Requires the raw-api
feature to be enabled.
See DashMap::shards()
and DashMap::shards_mut()
for more information.
pub fn determine_map<Q>(&self, key: &Q) -> usize
pub fn determine_map<Q>(&self, key: &Q) -> usize
Finds which shard a certain key is stored in. You should probably not use this unless you know what you are doing. Note that shard selection is dependent on the default or provided HashBuilder.
Requires the raw-api
feature to be enabled.
§Examples
use dashmap::DashMap;
let map = DashMap::new();
map.insert("coca-cola", 1.4);
println!("coca-cola is stored in shard: {}", map.determine_map("coca-cola"));
pub fn determine_shard(&self, hash: usize) -> usize
pub fn determine_shard(&self, hash: usize) -> usize
Finds which shard a certain hash is stored in.
Requires the raw-api
feature to be enabled.
§Examples
use dashmap::DashMap;
let map: DashMap<i32, i32> = DashMap::new();
let key = "key";
let hash = map.hash_usize(&key);
println!("hash is stored in shard: {}", map.determine_shard(hash));
pub fn hasher(&self) -> &S
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>
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)>
pub fn remove<Q>(&self, key: &Q) -> Option<(K, V)>
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)>
pub fn remove_if<Q>( &self, key: &Q, f: impl FnOnce(&K, &V) -> bool, ) -> Option<(K, V)>
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)>
pub fn iter(&'a self) -> Iter<'a, K, V, S>
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>
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>>
pub fn get<Q>(&'a self, key: &Q) -> Option<Ref<'a, K, V, S>>
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>>
pub fn get_mut<Q>(&'a self, key: &Q) -> Option<RefMut<'a, K, V, S>>
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>>
pub fn try_get<Q>(&'a self, key: &Q) -> TryResult<Ref<'a, K, V, S>>
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>>
pub fn try_get_mut<Q>(&'a self, key: &Q) -> TryResult<RefMut<'a, K, V, S>>
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)
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)
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
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
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)
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
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)
pub fn alter<Q>(&self, key: &Q, f: impl FnOnce(&K, V) -> V)
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)
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>
pub fn view<Q, R>(&self, key: &Q, f: impl FnOnce(&K, &V) -> R) -> Option<R>
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) -> bool
pub fn contains_key<Q>(&self, key: &Q) -> bool
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>
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>>
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>
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<K, V, S> Extend<(K, V)> for DashMap<K, V, S>
impl<K, V, S> Extend<(K, V)> for DashMap<K, V, S>
§fn extend<I>(&mut self, intoiter: I)where
I: IntoIterator<Item = (K, V)>,
fn extend<I>(&mut self, intoiter: I)where
I: IntoIterator<Item = (K, V)>,
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)§impl<K, V, S> FromIterator<(K, V)> for DashMap<K, V, S>
impl<K, V, S> FromIterator<(K, V)> for DashMap<K, V, S>
§impl<'a, K, V, S> IntoIterator for &'a DashMap<K, V, S>
impl<'a, K, V, S> IntoIterator for &'a DashMap<K, V, S>
§impl<K, V, S> IntoIterator for DashMap<K, V, S>
impl<K, V, S> IntoIterator for DashMap<K, V, S>
§impl<'a, K, V, S> Map<'a, K, V, S> for DashMap<K, V, S>
impl<'a, K, V, S> Map<'a, K, V, S> for DashMap<K, V, S>
fn _shard_count(&self) -> usize
§unsafe fn _get_read_shard(
&'a self,
i: usize,
) -> &'a HashMap<K, SharedValue<V>, S>
unsafe fn _get_read_shard( &'a self, i: usize, ) -> &'a HashMap<K, SharedValue<V>, S>
§unsafe fn _yield_read_shard(
&'a self,
i: usize,
) -> RwLockReadGuard<'a, RawRwLock, HashMap<K, SharedValue<V>, S>>
unsafe fn _yield_read_shard( &'a self, i: usize, ) -> RwLockReadGuard<'a, RawRwLock, HashMap<K, SharedValue<V>, S>>
§unsafe fn _yield_write_shard(
&'a self,
i: usize,
) -> RwLockWriteGuard<'a, RawRwLock, HashMap<K, SharedValue<V>, S>>
unsafe fn _yield_write_shard( &'a self, i: usize, ) -> RwLockWriteGuard<'a, RawRwLock, HashMap<K, SharedValue<V>, S>>
§unsafe fn _try_yield_read_shard(
&'a self,
i: usize,
) -> Option<RwLockReadGuard<'a, RawRwLock, HashMap<K, SharedValue<V>, S>>>
unsafe fn _try_yield_read_shard( &'a self, i: usize, ) -> Option<RwLockReadGuard<'a, RawRwLock, HashMap<K, SharedValue<V>, S>>>
§unsafe fn _try_yield_write_shard(
&'a self,
i: usize,
) -> Option<RwLockWriteGuard<'a, RawRwLock, HashMap<K, SharedValue<V>, S>>>
unsafe fn _try_yield_write_shard( &'a self, i: usize, ) -> Option<RwLockWriteGuard<'a, RawRwLock, HashMap<K, SharedValue<V>, S>>>
fn _insert(&self, key: K, value: V) -> Option<V>
fn _remove<Q>(&self, key: &Q) -> Option<(K, V)>
fn _remove_if<Q>( &self, key: &Q, f: impl FnOnce(&K, &V) -> bool, ) -> Option<(K, V)>
fn _remove_if_mut<Q>( &self, key: &Q, f: impl FnOnce(&K, &mut V) -> bool, ) -> Option<(K, V)>
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>>
fn _get_mut<Q>(&'a self, key: &Q) -> Option<RefMut<'a, K, V, S>>
fn _try_get<Q>(&'a self, key: &Q) -> TryResult<Ref<'a, K, V, S>>
fn _try_get_mut<Q>(&'a self, key: &Q) -> TryResult<RefMut<'a, K, V, S>>
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)
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>
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) -> bool
fn _is_empty(&self) -> bool
Auto Trait Implementations§
impl<K, V, S> Freeze for DashMap<K, V, S>where
S: Freeze,
impl<K, V, S = RandomState> !RefUnwindSafe for DashMap<K, V, S>
impl<K, V, S> Send for DashMap<K, V, S>
impl<K, V, S> Sync for DashMap<K, V, S>
impl<K, V, S> Unpin for DashMap<K, V, S>where
S: Unpin,
impl<K, V, S> UnwindSafe for DashMap<K, V, S>
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters
when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Filterable for T
impl<T> Filterable for T
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle
.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other
into Self
, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T
.§impl<I, T> IntoArgs for Iwhere
I: IntoIterator<Item = T>,
T: IntoValue,
impl<I, T> IntoArgs for Iwhere
I: IntoIterator<Item = T>,
T: IntoValue,
Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters
when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
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 moreSource§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self
into T
, while performing the appropriate scaling,
rounding and clamping.§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors
fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains
the unclamped color. Read more