Struct atomic_array::AtomicUsizeArray [−][src]
pub struct AtomicUsizeArray { /* fields omitted */ }
A usize
array in which elements may be updated atomically.
Methods
impl AtomicUsizeArray
[src]
impl AtomicUsizeArray
pub fn new(len: usize) -> Self
[src]
pub fn new(len: usize) -> Self
Constructs a new array with the specified length. All values will be initialized to their default.
pub fn new_with(
len: usize,
f: impl Fn(usize) -> usize
) -> Self
[src]
pub fn new_with(
len: usize,
f: impl Fn(usize) -> usize
) -> Self
Constructs a new array with the specified length. Uses the given function to construct each value.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Returns the number of elements in the array.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Returns true
if the array has a length of 0.
pub fn load(&self, index: usize) -> usize
[src]
pub fn load(&self, index: usize) -> usize
Loads and returns the value at the given position.
Panics if index
is out of bounds.
pub fn store(&self, index: usize, value: usize)
[src]
pub fn store(&self, index: usize, value: usize)
Stores the value at the given position.
Panics if index
is out bounds.
pub fn swap(&self, index: usize, value: usize) -> usize
[src]
pub fn swap(&self, index: usize, value: usize) -> usize
Swaps the value at the given position, returning the previous value.
Panics if index
is out of bounds.
Auto Trait Implementations
impl Send for AtomicUsizeArray
impl Send for AtomicUsizeArray
impl Sync for AtomicUsizeArray
impl Sync for AtomicUsizeArray