Struct rarena_allocator::RefMut
source · pub struct RefMut<'a, T, A: Allocator> { /* private fields */ }Expand description
A mutable reference to a value T in the ARENA.
Implementations§
source§impl<'a, T, A: Allocator> RefMut<'a, T, A>
impl<'a, T, A: Allocator> RefMut<'a, T, A>
sourcepub fn as_mut_ptr(&mut self) -> NonNull<T>
pub fn as_mut_ptr(&mut self) -> NonNull<T>
Returns the pointer to the T, the pointer may not be initialized.
If the pointer is not initialized, then NonNull::dangling() is returned.
Trait Implementations§
source§impl<'a, T, A: Allocator> Memory for RefMut<'a, T, A>
impl<'a, T, A: Allocator> Memory for RefMut<'a, T, A>
source§unsafe fn detach(&mut self)
unsafe fn detach(&mut self)
Detach the value from the ARENA, which means when the value is dropped, the underlying memory will not be collected for futhur allocation.
§Safety
- If
Tis not inlined (core::mem::needs_drop::<T>()returnstrue), then users should take care of dropping the value by themselves.
source§fn memory_capacity(&self) -> usize
fn memory_capacity(&self) -> usize
Returns how many bytes of the whole memory occupies.
source§fn memory_offset(&self) -> usize
fn memory_offset(&self) -> usize
Returns the offset to the pointer of the allocator.
source§fn flush(&self) -> Result<()>
fn flush(&self) -> Result<()>
Available on crate feature
memmap and non-target_family="wasm" only.Flush the buffer to the disk.
source§fn flush_async(&self) -> Result<()>
fn flush_async(&self) -> Result<()>
Available on crate feature
memmap and non-target_family="wasm" only.Asynchronously flush the buffer to the disk.
Auto Trait Implementations§
impl<'a, T, A> Freeze for RefMut<'a, T, A>where
T: Freeze,
impl<'a, T, A> RefUnwindSafe for RefMut<'a, T, A>where
A: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T, A> !Send for RefMut<'a, T, A>
impl<'a, T, A> !Sync for RefMut<'a, T, A>
impl<'a, T, A> Unpin for RefMut<'a, T, A>where
T: Unpin,
impl<'a, T, A> UnwindSafe for RefMut<'a, T, A>
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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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