pub struct SharedVec<T: Copy + 'static> { /* private fields */ }Implementations§
pub fn create(path: impl AsRef<Path>, capacity: usize) -> Result<Self, VecError>
pub fn open( path: impl AsRef<Path>, expected_capacity: usize, ) -> Result<Self, VecError>
pub fn capacity(&self) -> usize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn push_back(&self, v: T) -> Result<usize, VecError>
pub fn push_back(&self, v: T) -> Result<usize, VecError>
Append a value. Returns the index it landed at.
Returns Err(Full) when the vec is at capacity.
Sourcepub fn pop_back(&self) -> Option<T>
pub fn pop_back(&self) -> Option<T>
Remove and return the last element. Returns None when empty.
Sourcepub fn get(&self, i: usize) -> Option<T>
pub fn get(&self, i: usize) -> Option<T>
Read the value at index i. Returns None when i >= len.
Sourcepub fn set(&self, i: usize, v: T) -> Result<(), VecError>
pub fn set(&self, i: usize, v: T) -> Result<(), VecError>
Overwrite the value at index i. Returns Err(OutOfBounds)
when i >= len.
Sourcepub fn clear(&self)
pub fn clear(&self)
Clear the vec by resetting len to 0. Slot payloads are not zeroed; they become unreachable through bounded indexing.
Sourcepub fn snapshot(&self) -> Vec<T>
pub fn snapshot(&self) -> Vec<T>
Snapshot all current values into a Vec. Best-effort: under
concurrent writers, the snapshot is a consistent prefix at
the moment of the len load, with each slot read under its
own SeqLock.
pub fn flush(&self) -> Result<(), VecError>
Sourcepub fn flush_async(&self) -> Result<(), VecError>
pub fn flush_async(&self) -> Result<(), VecError>
Non-blocking flush: schedules a writeback via the OS. Note: Windows is only partially async (sync to page cache, not to disk).
Trait Implementations§
fn header(&self) -> &HandshakeHeader
fn ring(&self) -> &ObservationRing
fn make_policy(&self) -> Box<dyn Policy>
Source§fn apply_migration(&self, new_tag: u32)
fn apply_migration(&self, new_tag: u32)
Called by the sidecar when the policy returns a new strategy
tag. Default implementation: just set the tag on the header.
Primitives that need heavier migration (data-layout swap)
override this to perform the swap before (or after) updating
the tag.
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