pub struct VecStore<A: Agent> { /* private fields */ }Expand description
Dense vector-based agent store.
Uses agent IDs as indices into a Vec<Option<RefCell<A>>>. Provides
faster iteration than HashMapStore when IDs form a dense, contiguous
range starting near 0.
Iteration order is ascending by agent ID, which makes it suitable for deterministic workflows when paired with deterministic stepping logic.
Inserting an agent with a large ID will grow the internal vector to accommodate it, potentially wasting memory for sparse ID spaces.
Implementations§
Trait Implementations§
Source§impl<A: Agent> AgentStore<A> for VecStore<A>
impl<A: Agent> AgentStore<A> for VecStore<A>
Source§fn get_mut(&self, id: AgentId) -> Option<RefMut<'_, A>>
fn get_mut(&self, id: AgentId) -> Option<RefMut<'_, A>>
Borrow an agent mutably by ID. Read more
Source§fn remove(&mut self, id: AgentId) -> Option<A>
fn remove(&mut self, id: AgentId) -> Option<A>
Remove and return an agent by ID, or
None if not found.Auto Trait Implementations§
impl<A> Freeze for VecStore<A>
impl<A> !RefUnwindSafe for VecStore<A>
impl<A> Send for VecStore<A>where
A: Send,
impl<A> !Sync for VecStore<A>
impl<A> Unpin for VecStore<A>where
A: Unpin,
impl<A> UnsafeUnpin for VecStore<A>
impl<A> UnwindSafe for VecStore<A>where
A: 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