[−][src]Struct rustc_ap_rustc_data_structures::sharded::Sharded
An array of cache-line aligned inner locked structures with convenience methods.
Implementations
impl<T> Sharded<T>
[src]
pub fn new(value: impl FnMut() -> T) -> Self
[src]
pub fn get_shard_by_value<K: Hash + ?Sized>(&self, val: &K) -> &Lock<T>
[src]
The shard is selected by hashing val
with FxHasher
.
pub fn get_shard_index_by_hash(&self, hash: u64) -> usize
[src]
Get a shard with a pre-computed hash value. If get_shard_by_value
is
ever used in combination with get_shard_by_hash
on a single Sharded
instance, then hash
must be computed with FxHasher
. Otherwise,
hash
can be computed with any hasher, so long as that hasher is used
consistently for each Sharded
instance.
pub fn get_shard_by_hash(&self, hash: u64) -> &Lock<T>
[src]
pub fn get_shard_by_index(&self, i: usize) -> &Lock<T>
[src]
pub fn lock_shards(&self) -> Vec<LockGuard<T>>
[src]
pub fn try_lock_shards(&self) -> Option<Vec<LockGuard<T>>>
[src]
impl<K: Eq, V> Sharded<HashMap<K, V, BuildHasherDefault<FxHasher>>>
[src]
impl<K: Eq + Hash + Copy> Sharded<HashMap<K, V, BuildHasherDefault<FxHasher>>>
[src]
pub fn intern_ref<Q: ?Sized>(&self, value: &Q, make: impl FnOnce() -> K) -> K where
K: Borrow<Q>,
Q: Hash + Eq,
[src]
K: Borrow<Q>,
Q: Hash + Eq,
pub fn intern<Q>(&self, value: Q, make: impl FnOnce(Q) -> K) -> K where
K: Borrow<Q>,
Q: Hash + Eq,
[src]
K: Borrow<Q>,
Q: Hash + Eq,
impl<K: Eq + Hash + Copy + IntoPointer> Sharded<HashMap<K, V, BuildHasherDefault<FxHasher>>>
[src]
pub fn contains_pointer_to<T: Hash + IntoPointer>(&self, value: &T) -> bool
[src]
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for Sharded<T>
impl<T> Send for Sharded<T> where
T: Send,
T: Send,
impl<T> !Sync for Sharded<T>
impl<T> Unpin for Sharded<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Sharded<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Erased for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<E> SpecializationError for E
[src]
default fn not_found<S, T>(
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
[src]
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,