pub struct RingArena { /* private fields */ }Expand description
Ring buffer arena allocator for circular allocation patterns
Implementations§
Source§impl RingArena
impl RingArena
pub fn new( base_ptr: NonNull<u8>, size: usize, ring_config: RingConfig, ) -> Result<Self, ArenaError>
Sourcepub fn allocate(&mut self, size: usize) -> Result<NonNull<u8>, ArenaError>
pub fn allocate(&mut self, size: usize) -> Result<NonNull<u8>, ArenaError>
Allocate from ring buffer
Sourcepub fn consume(&mut self, size: usize) -> Result<(), ArenaError>
pub fn consume(&mut self, size: usize) -> Result<(), ArenaError>
Mark data as consumed (advance read pointer)
Sourcepub fn get_ring_usage(&self) -> RingUsage
pub fn get_ring_usage(&self) -> RingUsage
Get ring buffer usage
Auto Trait Implementations§
impl Freeze for RingArena
impl RefUnwindSafe for RingArena
impl Send for RingArena
impl Sync for RingArena
impl Unpin for RingArena
impl UnsafeUnpin for RingArena
impl UnwindSafe for RingArena
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