# Struct crossbeam::CachePadded [−] [src]

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

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.

## Methods

### `impl<T: ZerosValid> CachePadded<T>`
[src]

#### `pub fn zeroed() -> CachePadded<T>`
[src]

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

### `impl<T> CachePadded<T>`
[src]

#### `pub fn new(t: T) -> CachePadded<T>`
[src]

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

### `impl<T> Debug for CachePadded<T>`
[src]

#### `fn fmt(&self, f: &mut Formatter) -> Result`
[src]

Formats the value using the given formatter. Read more

### `impl<T: Send> Send for CachePadded<T>`
[src]

### `impl<T: Sync> Sync for CachePadded<T>`
[src]

### `impl<T> Deref for CachePadded<T>`
[src]

#### `type Target = T`

The resulting type after dereferencing.

#### `fn deref(&self) -> &T`
[src]

Dereferences the value.

### `impl<T> DerefMut for CachePadded<T>`
[src]

#### `fn deref_mut(&mut self) -> &mut T`
[src]

Mutably dereferences the value.

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)