Struct rustc_ap_rustc_data_structures::sharded::Sharded[][src]

pub struct Sharded<T> { /* fields omitted */ }

An array of cache-line aligned inner locked structures with convenience methods.

Implementations

impl<T> Sharded<T>[src]

pub fn new(mut 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>>

Notable traits for Vec<u8, Global>

impl Write for Vec<u8, Global>
[src]

pub fn try_lock_shards(&self) -> Option<Vec<LockGuard<'_, T>>>[src]

impl<K: Eq, V> Sharded<HashMap<K, V, BuildHasherDefault<FxHasher>>>[src]

pub fn len(&self) -> usize[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]

pub fn intern<Q>(&self, value: Q, make: impl FnOnce(Q) -> K) -> K where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

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

impl<T: Clone> Clone for Sharded<T>[src]

impl<T: Default> Default for Sharded<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Sharded<T>[src]

impl<T> Send for Sharded<T> where
    T: Send
[src]

impl<T> !Sync for Sharded<T>[src]

impl<T> Unpin for Sharded<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for Sharded<T> where
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized
[src]

impl<T> Erased for T[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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