Struct fdf::ArenaStaticBox

source ·
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>

source

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.

source

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.

source

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: Debug + ?Sized> Debug for ArenaStaticBox<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: ?Sized> Deref for ArenaStaticBox<T>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T: ?Sized> DerefMut for ArenaStaticBox<T>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<T: ?Sized> From<ArenaStaticBox<T>> for ArenaRc<T>

source§

fn from(value: ArenaStaticBox<T>) -> Self

Converts to this type from the input type.
source§

impl<T: 'static> IntoIterator for ArenaStaticBox<[T]>

§

type IntoIter = IntoIter<T, Arena>

Which kind of iterator are we turning this into?
§

type Item = T

The type of the elements being iterated over.
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<T> Send for ArenaStaticBox<T>
where T: Send + ?Sized,

SAFETY: ArenaStaticBox impls Send and Sync if T impls them.

source§

impl<T> Sync for ArenaStaticBox<T>
where T: Sync + ?Sized,

Auto Trait Implementations§

§

impl<T> Freeze for ArenaStaticBox<T>
where T: ?Sized,

§

impl<T> RefUnwindSafe for ArenaStaticBox<T>
where T: RefUnwindSafe + ?Sized,

§

impl<T> Unpin for ArenaStaticBox<T>
where T: ?Sized,

§

impl<T> UnwindSafe for ArenaStaticBox<T>
where T: RefUnwindSafe + ?Sized,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.