Struct crossbeam::mem::CachePadded[][src]

pub struct CachePadded<T> { /* fields omitted */ }
Expand description

Pad T to the length of a cacheline.

Sometimes concurrent programming requires a piece of data to be padded out to the size of a cacheline to avoid “false sharing”: cachelines being invalidated due to unrelated concurrent activity. Use the CachePadded type when you want to avoid cache locality.

At the moment, cache lines are assumed to be 32 * sizeof(usize) on all architectures.

Warning: the wrapped data is never dropped; move out using ptr::read if you need to run dtors.

Implementations

A const fn equivalent to mem::zeroed().

Wrap t with cacheline padding.

Warning: the wrapped data is never dropped; move out using ptr:read if you need to run dtors.

Trait Implementations

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

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

Performs the conversion.

Performs the conversion.

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.