pub struct ExtraColumns { /* private fields */ }Expand description
Storage for user-defined extra columns on a replay buffer.
Each column is a flat Vec<f32> with a fixed dimensionality, stored
contiguously for cache-friendly sampling. When no columns are registered,
this struct has zero overhead — no allocations occur.
Implementations§
Source§impl ExtraColumns
impl ExtraColumns
Sourcepub fn register(&mut self, name: &str, dim: usize) -> ColumnHandle
pub fn register(&mut self, name: &str, dim: usize) -> ColumnHandle
Register a new column. Returns a handle for O(1) access.
Must be called before any data is pushed. If storage has already been
allocated (via allocate()), the new column is pre-allocated too.
Sourcepub fn num_columns(&self) -> usize
pub fn num_columns(&self) -> usize
Number of registered columns.
Sourcepub fn column_info(&self, handle: ColumnHandle) -> (&str, usize)
pub fn column_info(&self, handle: ColumnHandle) -> (&str, usize)
Get column name and dim by handle.
Sourcepub fn push(
&mut self,
handle: ColumnHandle,
pos: usize,
values: &[f32],
) -> Result<(), RloxError>
pub fn push( &mut self, handle: ColumnHandle, pos: usize, values: &[f32], ) -> Result<(), RloxError>
Write values for one column at a given buffer position.
The values slice must have length equal to the column’s dimensionality.
Sourcepub fn sample(&self, handle: ColumnHandle, indices: &[usize]) -> Vec<f32>
pub fn sample(&self, handle: ColumnHandle, indices: &[usize]) -> Vec<f32>
Gather values for one column at the given sampled indices.
Returns a flat Vec<f32> of length indices.len() * dim.
Trait Implementations§
Source§impl Debug for ExtraColumns
impl Debug for ExtraColumns
Auto Trait Implementations§
impl Freeze for ExtraColumns
impl RefUnwindSafe for ExtraColumns
impl Send for ExtraColumns
impl Sync for ExtraColumns
impl Unpin for ExtraColumns
impl UnwindSafe for ExtraColumns
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more