pub struct BumpAllocator {
inner: SingleThreaded<RefCell<Inner>>,
}
Fields§
§inner: SingleThreaded<RefCell<Inner>>
Implementations§
Source§impl BumpAllocator
impl BumpAllocator
pub const fn new() -> Self
Sourcepub unsafe fn init(&self, mem: MemoryRange)
pub unsafe fn init(&self, mem: MemoryRange)
Initialize the bump allocator with the specified memory range.
§Safety
The caller must guarantee that the memory range is both valid to access via the current pagetable identity map, and that it is unused.
Sourcepub fn enable_alloc(&self)
pub fn enable_alloc(&self)
Enable allocations. This panics if allocations were ever previously enabled.
Sourcepub fn disable_alloc(&self)
pub fn disable_alloc(&self)
Disable allocations. Panics if the allocator was not previously enabled.
pub fn log_stats(&self)
Trait Implementations§
Source§impl GlobalAlloc for BumpAllocator
impl GlobalAlloc for BumpAllocator
Source§unsafe fn alloc(&self, layout: Layout) -> *mut u8
unsafe fn alloc(&self, layout: Layout) -> *mut u8
Allocates memory as described by the given
layout
. Read moreAuto Trait Implementations§
impl !Freeze for BumpAllocator
impl !RefUnwindSafe for BumpAllocator
impl !Send for BumpAllocator
impl Sync for BumpAllocator
impl Unpin for BumpAllocator
impl UnwindSafe for BumpAllocator
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