Struct catalyst_entities::Arena
source · #[repr(transparent)]pub struct Arena { /* private fields */ }Expand description
Arena is safe wrapper around Allocator that allows to allocate values that dont need
dropping.
Implementations§
source§impl Arena
impl Arena
sourcepub fn alloc<T>(&self, value: T) -> &T
pub fn alloc<T>(&self, value: T) -> &T
Allocate value in arena. Value must not need dropping which will be asserted at compile time.
sourcepub fn alloc_slice<T>(&self, value: &[T]) -> &[T] ⓘ
pub fn alloc_slice<T>(&self, value: &[T]) -> &[T] ⓘ
Analogous to alloc but for slices.
sourcepub fn alloc_iter<T, I>(&self, iter: I) -> &[T] ⓘwhere
I: IntoIterator<Item = T>,
I::IntoIter: ExactSizeIterator,
pub fn alloc_iter<T, I>(&self, iter: I) -> &[T] ⓘwhere I: IntoIterator<Item = T>, I::IntoIter: ExactSizeIterator,
Analogous to alloc_slice but for iterators.
sourcepub fn alloc_byte_layout(&self, layout: Layout) -> &mut [u8] ⓘ
pub fn alloc_byte_layout(&self, layout: Layout) -> &mut [u8] ⓘ
More low level function that allocates sequence of arbitrary bytes compatible with passed layout.
sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clear arena, since all allocated values dont need dropping, we can just reset allocator. This function is safe since it requires mutable arena whitch implies all allocations are dropped.
sourcepub fn into_allocator(self) -> Allocator
pub fn into_allocator(self) -> Allocator
Get allocator from arena.
Trait Implementations§
Auto Trait Implementations§
impl !ArchiveCopy for Arena
impl !NoInteriorMutability for Arena
impl !RefUnwindSafe for Arena
impl !Sync for Arena
impl Unpin for Arena
impl UnwindSafe for Arena
Blanket Implementations§
source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.