pub struct ConcurrentVec<T> { /* private fields */ }Expand description
A thread-safe vector using RwLock.
Provides concurrent read access with exclusive write access.
§Example
use spider_core::state::ConcurrentVec;
let vec = ConcurrentVec::new();
vec.push(1);
vec.push(2);
assert_eq!(vec.len(), 2);Implementations§
Source§impl<T> ConcurrentVec<T>
impl<T> ConcurrentVec<T>
Sourcepub fn new() -> ConcurrentVec<T>
pub fn new() -> ConcurrentVec<T>
Creates a new empty vector.
Sourcepub fn with_capacity(capacity: usize) -> ConcurrentVec<T>
pub fn with_capacity(capacity: usize) -> ConcurrentVec<T>
Creates a vector with the specified capacity.
Trait Implementations§
Source§impl<T> Clone for ConcurrentVec<T>
impl<T> Clone for ConcurrentVec<T>
Source§fn clone(&self) -> ConcurrentVec<T>
fn clone(&self) -> ConcurrentVec<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§impl<T> Debug for ConcurrentVec<T>where
T: Debug,
impl<T> Debug for ConcurrentVec<T>where
T: Debug,
Source§impl<T> Default for ConcurrentVec<T>where
T: Default,
impl<T> Default for ConcurrentVec<T>where
T: Default,
Source§fn default() -> ConcurrentVec<T>
fn default() -> ConcurrentVec<T>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<T> !Freeze for ConcurrentVec<T>
impl<T> !RefUnwindSafe for ConcurrentVec<T>
impl<T> Send for ConcurrentVec<T>where
T: Send,
impl<T> Sync for ConcurrentVec<T>
impl<T> Unpin for ConcurrentVec<T>where
T: Unpin,
impl<T> UnsafeUnpin for ConcurrentVec<T>
impl<T> UnwindSafe for ConcurrentVec<T>where
T: UnwindSafe,
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