pub struct PageAlignedAllocator;Available on crate feature
protected only.Expand description
Custom page-aligned allocator implementation. Creates blocks of page-aligned heap-allocated memory regions, with no-access pages before and after the allocated region of memory. Allocations whose requested alignment does not divide the host page size are rejected.
Trait Implementations§
Source§impl Allocator for PageAlignedAllocator
impl Allocator for PageAlignedAllocator
Source§unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
§Safety
ptr must be a user-region pointer previously returned by this
allocator’s allocate method with the same layout.
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
1.101.0 (const: unstable) · 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 more1.101.0 (const: unstable) · Source§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
Auto Trait Implementations§
impl Freeze for PageAlignedAllocator
impl RefUnwindSafe for PageAlignedAllocator
impl Send for PageAlignedAllocator
impl Sync for PageAlignedAllocator
impl Unpin for PageAlignedAllocator
impl UnsafeUnpin for PageAlignedAllocator
impl UnwindSafe for PageAlignedAllocator
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