pub trait Impl {
// Required methods
fn map(addr: NonNull<u8>, size: usize, direction: Direction) -> u64;
fn unmap(addr: NonNull<u8>, size: usize);
fn flush(addr: NonNull<u8>, size: usize);
fn invalidate(addr: NonNull<u8>, size: usize);
// Provided methods
unsafe fn alloc(layout: Layout) -> *mut u8 { ... }
unsafe fn dealloc(ptr: *mut u8, layout: Layout) { ... }
}
Required Methods§
Sourcefn map(addr: NonNull<u8>, size: usize, direction: Direction) -> u64
fn map(addr: NonNull<u8>, size: usize, direction: Direction) -> u64
map virt address to physical address
Sourcefn invalidate(addr: NonNull<u8>, size: usize)
fn invalidate(addr: NonNull<u8>, size: usize)
invalidate cache
Provided Methods§
Sourceunsafe fn alloc(layout: Layout) -> *mut u8
unsafe fn alloc(layout: Layout) -> *mut u8
alloc memory.
§Safety
layout must have non-zero size. Attempting to allocate for a zero-sized layout may result in undefined behavior.
Sourceunsafe fn dealloc(ptr: *mut u8, layout: Layout)
unsafe fn dealloc(ptr: *mut u8, layout: Layout)
Deallocates the block of memory at the given ptr
pointer with the given layout
.
§Safety
The caller must ensure:
-
ptr
is a block of memory currently allocated via this allocator and, -
layout
is the same layout that was used to allocate that block of memory.
Otherwise undefined behavior can result.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.