pub struct DroplessArena { /* private fields */ }
Expand description
An arena that can hold objects of multiple different types that impl Copy
and/or satisfy !mem::needs_drop
.
Implementations§
Source§impl DroplessArena
impl DroplessArena
pub fn alloc_raw(&self, layout: Layout) -> *mut u8
pub fn alloc<T>(&self, object: T) -> &mut T
Sourcepub fn alloc_slice<T>(&self, slice: &[T]) -> &mut [T]where
T: Copy,
pub fn alloc_slice<T>(&self, slice: &[T]) -> &mut [T]where
T: Copy,
Allocates a slice of objects that are copied into the DroplessArena
, returning a mutable
reference to it. Will panic if passed a zero-sized type.
Panics:
- Zero-sized types
- Zero-length slices
Sourcepub fn contains_slice<T>(&self, slice: &[T]) -> bool
pub fn contains_slice<T>(&self, slice: &[T]) -> bool
Used by Lift
to check whether this slice is allocated
in this arena.
Sourcepub fn alloc_str(&self, string: &str) -> &str
pub fn alloc_str(&self, string: &str) -> &str
Allocates a string slice that is copied into the DroplessArena
, returning a
reference to it. Will panic if passed an empty string.
Panics:
- Zero-length string
pub fn alloc_from_iter<T, I: IntoIterator<Item = T>>(&self, iter: I) -> &mut [T]
Trait Implementations§
Source§impl Default for DroplessArena
impl Default for DroplessArena
Source§fn default() -> DroplessArena
fn default() -> DroplessArena
Returns the “default value” for a type. Read more
impl Send for DroplessArena
Auto Trait Implementations§
impl !Freeze for DroplessArena
impl !RefUnwindSafe for DroplessArena
impl !Sync for DroplessArena
impl Unpin for DroplessArena
impl UnwindSafe for DroplessArena
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more