Arena

Struct Arena 

Source
pub struct Arena { /* private fields */ }

Implementations§

Source§

impl Arena

Source

pub fn new<T: Finalize>(capacity: usize) -> Self

Source

pub unsafe fn new_raw( type_hash: TypeHash, item_layout: Layout, finalizer: unsafe fn(*mut ()), capacity: usize, ) -> Self

§Safety
Source

pub fn type_hash(&self) -> TypeHash

Source

pub fn item_layout(&self) -> &Layout

Source

pub fn finalizer(&self) -> unsafe fn(*mut ())

Source

pub fn capacity(&self) -> usize

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn contains(&self, index: Index) -> bool

Source

pub fn clear(&mut self)

Source

pub fn insert<T>(&mut self, value: T) -> Result<Index, ArenaError>

Source

pub unsafe fn allocate(&mut self) -> (Index, *mut u8)

§Safety
Source

pub fn remove(&mut self, index: Index) -> Result<(), ArenaError>

Source

pub fn read<T>( &self, index: Index, ) -> Result<ValueReadAccess<'_, T>, ArenaError>

Source

pub fn write<T>( &self, index: Index, ) -> Result<ValueWriteAccess<'_, T>, ArenaError>

Source

pub unsafe fn read_ptr(&self, index: Index) -> Result<*const u8, ArenaError>

§Safety
Source

pub unsafe fn write_ptr(&self, index: Index) -> Result<*mut u8, ArenaError>

§Safety
Source

pub fn is<T>(&self, index: Index) -> Result<bool, ArenaError>

Source

pub fn is_raw( &self, index: Index, type_hash: TypeHash, ) -> Result<bool, ArenaError>

Source

pub fn indices(&self) -> impl Iterator<Item = Index> + '_

Source

pub fn iter<'a, T: 'a>(&'a self) -> impl Iterator<Item = ValueReadAccess<'a, T>>

Source

pub fn iter_mut<'a, T: 'a>( &'a self, ) -> impl Iterator<Item = ValueWriteAccess<'a, T>>

Trait Implementations§

Source§

impl Drop for Arena

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for Arena

Source§

impl Sync for Arena

Auto Trait Implementations§

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> Finalize for T

Source§

unsafe fn finalize_raw(data: *mut ())

Safety 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>,

Source§

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>,

Source§

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.