Struct __Arena
pub struct __Arena(/* private fields */);Expand description
Implements a memory arena allocator to be used with the Fuchsia Driver Runtime when sending and receiving from channels.
Implementations§
§impl Arena
impl Arena
pub fn contains_ptr<T>(&self, ptr: &T) -> boolwhere
T: ?Sized,
pub fn contains_ptr<T>(&self, ptr: &T) -> boolwhere
T: ?Sized,
Returns true if the allocation pointed to was made by this arena
pub fn contains<T>(&self, item: &ArenaBox<'_, T>) -> boolwhere
T: ?Sized,
pub fn contains<T>(&self, item: &ArenaBox<'_, T>) -> boolwhere
T: ?Sized,
Returns true if the allocation was made by this arena
pub fn insert_uninit<T>(&self) -> ArenaBox<'_, MaybeUninit<T>>
pub fn insert_uninit<T>(&self) -> ArenaBox<'_, MaybeUninit<T>>
Inserts a MaybeUninit object and returns the [ArenaBox] of it.
pub fn insert_uninit_slice<T>(
&self,
len: usize,
) -> ArenaBox<'_, [MaybeUninit<T>]>
pub fn insert_uninit_slice<T>( &self, len: usize, ) -> ArenaBox<'_, [MaybeUninit<T>]>
Inserts a slice of MaybeUninit objects of len len
§Panics
Panics if an array [T; n] is too large to be allocated.
pub fn insert<T>(&self, obj: T) -> ArenaBox<'_, T>
pub fn insert<T>(&self, obj: T) -> ArenaBox<'_, T>
Moves obj of type T into the arena and returns an [ArenaBox]
containing the moved value.
pub fn insert_boxed_slice<T>(&self, slice: Box<[T]>) -> ArenaBox<'_, [T]>
pub fn insert_boxed_slice<T>(&self, slice: Box<[T]>) -> ArenaBox<'_, [T]>
Moves a Boxed slice into the arena and returns an [ArenaBox]
containing the moved value.
pub fn insert_slice<T>(&self, slice: &[T]) -> ArenaBox<'_, [T]>where
T: Clone,
pub fn insert_slice<T>(&self, slice: &[T]) -> ArenaBox<'_, [T]>where
T: Clone,
Copies the slice into the arena and returns an [ArenaBox] containing
the copied values.
pub fn insert_default_slice<T>(&self, len: usize) -> ArenaBox<'_, [T]>where
T: Default,
pub fn insert_default_slice<T>(&self, len: usize) -> ArenaBox<'_, [T]>where
T: Default,
pub unsafe fn assume_unchecked<T>(&self, ptr: NonNull<T>) -> ArenaBox<'_, T>where
T: ?Sized,
pub unsafe fn assume_unchecked<T>(&self, ptr: NonNull<T>) -> ArenaBox<'_, T>where
T: ?Sized,
Returns an ArenaBox for the pointed to object, assuming that it is part of this arena.
§Safety
This does not verify that the pointer came from this arena, so the caller is responsible for verifying that.
pub unsafe fn assume<T>(&self, ptr: NonNull<T>) -> ArenaBox<'_, T>where
T: ?Sized,
pub unsafe fn assume<T>(&self, ptr: NonNull<T>) -> ArenaBox<'_, T>where
T: ?Sized,
Returns an [ArenaBox] for the pointed to object, verifying that it
is a part of this arena in the process.
§Panics
This function panics if the given pointer is not in this Arena.
§Safety
The caller is responsible for ensuring that only one [ArenaBox] is constructed
for a given pointer, and that the pointer originated from an ArenaBox<T> or
a direct allocation with the arena through [fdf_arena_allocate], and is:
- initialized to a value of
T. - properly aligned for
T. - pointing to the beginning of the object, and not to a subfield of another
[
ArenaBox]ed object.
pub fn make_static<T>(&self, data: ArenaBox<'_, T>) -> ArenaStaticBox<T>where
T: ?Sized,
pub fn make_static<T>(&self, data: ArenaBox<'_, T>) -> ArenaStaticBox<T>where
T: ?Sized,
pub fn insert_from_iter<I>(
&self,
source: I,
) -> ArenaBox<'_, [<I as IntoIterator>::Item]>
pub fn insert_from_iter<I>( &self, source: I, ) -> ArenaBox<'_, [<I as IntoIterator>::Item]>
Creates an [ArenaBox]ed slice from an iterator implementing ExactSizeIterator. Note
that if ExactSizeIterator::len returns an incorrect value, the returned [ArenaBox]
will be no more than the length returned, and may be less.
pub fn try_insert_from_iter<I, T, E>(
&self,
source: I,
) -> Result<ArenaBox<'_, [T]>, E>
pub fn try_insert_from_iter<I, T, E>( &self, source: I, ) -> Result<ArenaBox<'_, [T]>, E>
Tries to create an [ArenaBox]ed slice from an iterator implementing ExactSizeIterator.
Note that if ExactSizeIterator::len returns an incorrect value, the returned
[ArenaBox] will be no more than the length returned, and may be less.
If any item returned by the iterator returns an Err() result, results so far are discarded