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§
source§impl<S: Default> Default for PrivateSharded<S>
impl<S: Default> Default for PrivateSharded<S>
source§fn default() -> PrivateSharded<S>
fn default() -> PrivateSharded<S>
Returns the “default value” for a type. Read more
source§impl<S: AsRef<[Shard]> + Default> LockStorage for PrivateSharded<S>
impl<S: AsRef<[Shard]> + Default> LockStorage for PrivateSharded<S>
source§fn gen_idx(&self) -> &AtomicUsize
fn gen_idx(&self) -> &AtomicUsize
Access to the generation index. Read more
source§fn choose_shard(&self) -> usize
fn choose_shard(&self) -> usize
Pick one shard of the all selected. Read more