Struct arc_swap::gen_lock::Shard

source ·
#[repr(align(64))]
pub struct Shard(_);
Expand description

A single shard.

This is one copy of place where the library keeps tracks of generation locks. It consists of a pair of counters and allows double-buffering readers (therefore, even if there’s a never-ending stream of readers coming in, writer will get through eventually).

To avoid contention and sharing of the counters between readers, we don’t have one pair of generation counters, but several. The reader picks one shard and uses that, while the writer looks through all of them. This is still not perfect (two threads may choose the same ID), but it helps.

Each LockStorage must provide a (non-empty) array of these.

Trait Implementations§

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

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.