Skip to main content

map_aligned

Function map_aligned 

Source
pub fn map_aligned(len: usize, align: usize) -> Option<NonNull<u8>>
Expand description

Map len bytes anonymously with the returned address aligned to align bytes.

align must be a power of two and a multiple of PAGE; len must be a non-zero multiple of align. Over-allocates by one alignment unit and trims both sides, because mmap only promises page alignment. Returns None on failure — never panics, because an allocator that panics on OOM is worse than one that reports it.