Struct rarena_allocator::Owned
source · pub struct Owned<T> { /* private fields */ }Expand description
An owned to a value T in the ARENA.
Implementations§
source§impl<T> Owned<T>
impl<T> Owned<T>
sourcepub unsafe fn detach(&mut self)
pub 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.
sourcepub const fn size(&self) -> usize
pub const fn size(&self) -> usize
Returns how many bytes of T occupies.
If this value is 0, then the T is ZST (zero sized type).
sourcepub const fn offset(&self) -> usize
pub const fn offset(&self) -> usize
Returns the offset of T to the pointer of the ARENA.
If this value is 0, then the T is ZST (zero sized type).
sourcepub const fn memory_size(&self) -> usize
pub const fn memory_size(&self) -> usize
Returns how many bytes of memory the value occupies.
If this value is 0, then the T is ZST (zero sized type).
sourcepub const fn memory_offset(&self) -> usize
pub const fn memory_offset(&self) -> usize
Returns the offset to the pointer of the ARENA.
If this value is 0, then the T is ZST (zero sized type).
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§
Auto Trait Implementations§
impl<T> Freeze for Owned<T>where
T: Freeze,
impl<T> RefUnwindSafe for Owned<T>where
T: RefUnwindSafe,
impl<T> !Send for Owned<T>
impl<T> !Sync for Owned<T>
impl<T> Unpin for Owned<T>where
T: Unpin,
impl<T> UnwindSafe for Owned<T>where
T: RefUnwindSafe + UnwindSafe,
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