pub struct AnonArea { /* private fields */ }
Implementations§
Source§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.
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
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