pub struct SharedArray<T>(/* private fields */);Expand description
A shared mutable array of T managed by reference counting.
§Cloning
The Clone trait implements cloning of the array by reference.
Use the clone_content() method to clone the array by content.
§Equality
The PartialEq trait performs reference comparison of two arrays.
§Hashing
The Hash trait performs hashing of the array by reference.
Implementations§
pub fn new() -> Self
pub fn get(&self, index: usize) -> Option<T>where
T: Clone,
pub fn set(&mut self, index: usize, value: T)where
T: Clone,
pub fn remove(&mut self, index: usize)
pub fn includes(&self, value: &T) -> boolwhere
T: PartialEq,
pub fn index_of(&self, value: &T) -> Option<usize>where
T: PartialEq,
pub fn length(&self) -> usize
pub fn push(&mut self, value: T)
pub fn clear(&mut self)
pub fn iter(&self) -> SharedArrayIterator<'_, T> ⓘwhere
T: Clone,
pub fn clone_content(&self) -> Selfwhere
T: Clone,
Trait Implementations§
Source§fn clone(&self) -> SharedArray<T>
fn clone(&self) -> SharedArray<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§fn extend<T: IntoIterator<Item = A>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = A>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§fn from_iter<T2: IntoIterator<Item = T>>(iter: T2) -> Self
fn from_iter<T2: IntoIterator<Item = T>>(iter: T2) -> Self
Creates a value from an iterator. Read more
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more