[][src]Struct mmap_allocator::MmapAllocator

pub struct MmapAllocator;

Implementation of std::alloc::GlobalAlloc whose backend is mmap(2)

Implementations

impl MmapAllocator[src]

pub const fn new() -> Self[src]

Creates a new instance.

Trait Implementations

impl Clone for MmapAllocator[src]

impl Copy for MmapAllocator[src]

impl Debug for MmapAllocator[src]

impl Default for MmapAllocator[src]

impl GlobalAlloc for MmapAllocator[src]

Portability

alloc() calls mmap() with flag MAP_ANONYMOUS. Many systems support the flag, however, it is not specified in POSIX.

Safety

All functions are thread safe.

Error

Each function don't cause panic but set OS errno on error.

Note that it is not an error to deallocate pointer which is not allocated. This is the spec of munmap(2). See man 2 munmap for details.

unsafe fn alloc(&self, layout: Layout) -> *mut u8[src]

Panics

This method may panic if the align of layout is greater than the kernel page align. (Basically, kernel page align is always greater than the align of layout that rust generates unless the programer dares to build such a layout on purpose.)

unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8[src]

Panics

This method can panic if the align of layout is greater than the kernel page align.

Auto Trait Implementations

impl RefUnwindSafe for MmapAllocator

impl Send for MmapAllocator

impl Sync for MmapAllocator

impl Unpin for MmapAllocator

impl UnwindSafe for MmapAllocator

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.