pub struct VirtualAllocator {}Expand description
Allocates entire pages of virtual memory for each allocation. This is intended for large allocations only, such as working with other allocators to provide a large chunk for them.
Trait Implementations§
Source§impl Allocator for VirtualAllocator
impl Allocator for VirtualAllocator
Source§fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
Attempts to allocate a block of memory. Read more
Source§fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
Behaves like
allocate, but also ensures that the returned memory is zero-initialized. Read moreSource§unsafe fn deallocate(&self, nonnull: NonNull<u8>, layout: Layout)
unsafe fn deallocate(&self, nonnull: NonNull<u8>, layout: Layout)
Deallocates the memory referenced by
ptr. Read moreSource§unsafe fn grow(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError>
Attempts to extend the memory block. Read more
Source§unsafe fn grow_zeroed(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow_zeroed( &self, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError>
Behaves like
grow, but also ensures that the new contents are set to zero before being
returned. Read moreSource§impl Clone for VirtualAllocator
impl Clone for VirtualAllocator
Source§fn clone(&self) -> VirtualAllocator
fn clone(&self) -> VirtualAllocator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VirtualAllocator
impl Debug for VirtualAllocator
impl Copy for VirtualAllocator
Auto Trait Implementations§
impl Freeze for VirtualAllocator
impl RefUnwindSafe for VirtualAllocator
impl Send for VirtualAllocator
impl Sync for VirtualAllocator
impl Unpin for VirtualAllocator
impl UnwindSafe for VirtualAllocator
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