pub struct ArenaStaticBox<T: ?Sized> { /* private fields */ }
Expand description
An equivalent to ArenaBox
that holds onto a reference to the
arena to allow it to have static lifetime.
Implementations§
Source§impl<T: ?Sized> ArenaStaticBox<T>
impl<T: ?Sized> ArenaStaticBox<T>
Sourcepub unsafe fn new_unchecked(
arena: Arena,
data: ArenaBox<'_, T>,
) -> ArenaStaticBox<T>
pub unsafe fn new_unchecked( arena: Arena, data: ArenaBox<'_, T>, ) -> ArenaStaticBox<T>
Transforms the given ArenaBox
into an ArenaStaticBox
with an owned
reference to the given Arena
, allowing for it to be used in 'static
contexts.
§Safety
The caller must ensure that the given ArenaBox
is owned by this
arena, or it may result in use-after-free.
Sourcepub fn unwrap(this: Self, arena: &mut Option<Arena>) -> ArenaBox<'_, T>
pub fn unwrap(this: Self, arena: &mut Option<Arena>) -> ArenaBox<'_, T>
Takes ownership over the arena and data backing the given
ArenaStaticBox
.
This returns an ArenaBox
tied to the lifetime of the &mut Option<Arena>
given, and places the arena in that space.
Sourcepub fn into_raw(this: Self) -> (NonNull<fdf_arena_t>, NonNull<T>)
pub fn into_raw(this: Self) -> (NonNull<fdf_arena_t>, NonNull<T>)
Takes ownership of the arena and data backing the given
ArenaStaticBox
as raw pointers.
Note that while this is safe, care must be taken to ensure that the raw pointer to the data is not accessed after the arena pointer has been released.
Trait Implementations§
Source§impl<T: ?Sized> Deref for ArenaStaticBox<T>
impl<T: ?Sized> Deref for ArenaStaticBox<T>
Source§impl<T: ?Sized> DerefMut for ArenaStaticBox<T>
impl<T: ?Sized> DerefMut for ArenaStaticBox<T>
Source§impl<T: ?Sized> From<ArenaStaticBox<T>> for ArenaRc<T>
impl<T: ?Sized> From<ArenaStaticBox<T>> for ArenaRc<T>
Source§fn from(value: ArenaStaticBox<T>) -> Self
fn from(value: ArenaStaticBox<T>) -> Self
Source§impl<T: 'static> IntoIterator for ArenaStaticBox<[T]>
impl<T: 'static> IntoIterator for ArenaStaticBox<[T]>
impl<T> Send for ArenaStaticBox<T>
SAFETY: ArenaStaticBox
impls Send
and Sync
if T
impls them.