pub struct AnonArea { /* private fields */ }
Implementations§
source§impl AnonArea
impl AnonArea
Anonymous memory which can be shared by multiple threads with RwLock protection. Accesses to memory positions only require read locking for both reads and writes.
pub fn new(size: usize, comp: f64) -> Self
pub fn size(&self) -> usize
pub fn resize(&mut self, size: usize)
sourcepub fn rel_to_page_idx(rel: f64, size: usize) -> usize
pub fn rel_to_page_idx(rel: f64, size: usize) -> usize
Determine the page given the relative position rel
and size
of
the anon area. rel
is in the range [-1.0, 1.0] with the position
0.0 mapping to the first page, positive positions to even slots and
negative odd so that modulating the amplitude of rel
changes how
much area is accessed without shifting the center.
sourcepub fn access_page<'a, T>(&'a self, page_idx: usize) -> &'a mut [T]
pub fn access_page<'a, T>(&'a self, page_idx: usize) -> &'a mut [T]
Return a mutable u8 reference to the position specified by the page index. The anon area is shared and there’s no access control.
pub fn fill_page_with_random(&self, page_idx: usize)
Auto Trait Implementations§
impl Freeze for AnonArea
impl RefUnwindSafe for AnonArea
impl Send for AnonArea
impl Sync for AnonArea
impl Unpin for AnonArea
impl UnwindSafe for AnonArea
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