pub struct Bump { /* private fields */ }Expand description
Fixed-capacity bump-pointer arena.
Implementations§
Source§impl Bump
impl Bump
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
New arena, pre-allocating a single chunk of capacity bytes
(promoted to a 64-byte floor and 16-byte alignment).
Sourcepub fn alloc_copy<T: Copy>(&mut self, value: T) -> &mut T
pub fn alloc_copy<T: Copy>(&mut self, value: T) -> &mut T
Allocate a Copy value. Panics if the arena is out of room.
Sourcepub fn try_alloc_copy<T: Copy>(&mut self, value: T) -> Option<&mut T>
pub fn try_alloc_copy<T: Copy>(&mut self, value: T) -> Option<&mut T>
Fallible alloc. Returns None if the arena can’t fit the value
at its natural alignment.
Sourcepub fn alloc_raw(&mut self, layout: Layout) -> *mut u8
pub fn alloc_raw(&mut self, layout: Layout) -> *mut u8
Allocate layout.size() bytes aligned to layout.align().
Panics if the request doesn’t fit.
Sourcepub fn try_alloc_raw(&mut self, layout: Layout) -> Option<*mut u8>
pub fn try_alloc_raw(&mut self, layout: Layout) -> Option<*mut u8>
Fallible raw alloc. Returns None if the request doesn’t fit.
Sourcepub fn total_capacity(&self) -> usize
pub fn total_capacity(&self) -> usize
Backwards-compatible alias for [capacity].
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Bump
impl RefUnwindSafe for Bump
impl !Send for Bump
impl !Sync for Bump
impl Unpin for Bump
impl UnsafeUnpin for Bump
impl UnwindSafe for Bump
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