pub struct Arena { /* private fields */ }Expand description
Contiguous f64 bump allocator.
Pre-allocates a fixed-size vector and hands out slices
(ArenaSlice) by advancing an internal cursor.
Implementations§
Source§impl Arena
impl Arena
Sourcepub fn alloc_slice(&self, n: usize) -> Option<ArenaSlice>
pub fn alloc_slice(&self, n: usize) -> Option<ArenaSlice>
Allocates a slice of n elements, returns None if capacity is insufficient.
Sourcepub fn write(&self, slice: &ArenaSlice, data: &[f64])
pub fn write(&self, slice: &ArenaSlice, data: &[f64])
Writes data into the given slice (truncated if data exceeds the slice length).
Sourcepub fn read(&self, slice: &ArenaSlice) -> Vec<f64>
pub fn read(&self, slice: &ArenaSlice) -> Vec<f64>
Reads the slice contents into a new Vec<f64>.
Sourcepub fn get(&self, slice: &ArenaSlice, index: usize) -> Option<f64>
pub fn get(&self, slice: &ArenaSlice, index: usize) -> Option<f64>
Returns the element at index within the slice, or None if out of bounds.
Sourcepub fn set(&self, slice: &ArenaSlice, index: usize, value: f64)
pub fn set(&self, slice: &ArenaSlice, index: usize, value: f64)
Sets value at index within the slice.
Auto Trait Implementations§
impl !Freeze for Arena
impl !RefUnwindSafe for Arena
impl Send for Arena
impl !Sync for Arena
impl Unpin for Arena
impl UnsafeUnpin for Arena
impl UnwindSafe for Arena
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