Struct arc_swap::gen_lock::PrivateSharded
source · pub struct PrivateSharded<S> { /* private fields */ }
Expand description
An alternative to PrivateUnsharded
, but with configurable number of shards.
The PrivateUnsharded
is almost identical to PrivateSharded<[Shard; 1]>
(the
implementation takes advantage of some details to avoid a little bit of overhead). It allows
the user to choose the trade-of between contention during locking and size of the pointer and
speed during writes.
Note on AsRef<[Shard]>
Rust provides the AsRef
trait (or, actually any trait) up to arrays of 32 elements. If you
need something bigger, you have to work around it with a newtype.
Trait Implementations
sourceimpl<S: Default> Default for PrivateSharded<S>
impl<S: Default> Default for PrivateSharded<S>
sourcefn default() -> PrivateSharded<S>
fn default() -> PrivateSharded<S>
Returns the “default value” for a type. Read more
sourceimpl<S: AsRef<[Shard]> + Default> LockStorage for PrivateSharded<S>
impl<S: AsRef<[Shard]> + Default> LockStorage for PrivateSharded<S>
sourcefn gen_idx(&self) -> &AtomicUsize
fn gen_idx(&self) -> &AtomicUsize
Access to the generation index. Read more
sourcefn choose_shard(&self) -> usize
fn choose_shard(&self) -> usize
Pick one shard of the all selected. Read more
Auto Trait Implementations
impl<S> RefUnwindSafe for PrivateSharded<S>where
S: RefUnwindSafe,
impl<S> Send for PrivateSharded<S>where
S: Send,
impl<S> Sync for PrivateSharded<S>where
S: Sync,
impl<S> Unpin for PrivateSharded<S>where
S: Unpin,
impl<S> UnwindSafe for PrivateSharded<S>where
S: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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