Struct arc_swap::gen_lock::PrivateSharded[][src]

pub struct PrivateSharded<S> { /* fields omitted */ }
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

impl<S: Default> Default for PrivateSharded<S>[src]

fn default() -> PrivateSharded<S>[src]

Returns the “default value” for a type. Read more

impl<S: AsRef<[Shard]> + Default> LockStorage for PrivateSharded<S>[src]

type Shards = S

The type for keeping several shards. Read more

fn gen_idx(&self) -> &AtomicUsize[src]

Access to the generation index. Read more

fn shards(&self) -> &Self::Shards[src]

Access to the shards storage. Read more

fn choose_shard(&self) -> usize[src]

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

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.