Struct memmap2::MmapRaw[][src]

pub struct MmapRaw { /* fields omitted */ }

A handle to a raw memory mapped buffer.

This struct never hands out references to its interior, only raw pointers. This can be helpful when creating shared memory maps between untrusted processes.

Implementations

impl MmapRaw[src]

pub fn map_raw(file: &File) -> Result<MmapRaw>[src]

Creates a writeable memory map backed by a file.

This is equivalent to calling MmapOptions::new().map_raw(file).

Errors

This method returns an error when the underlying system call fails, which can happen for a variety of reasons, such as when the file is not open with read and write permissions.

pub fn as_ptr(&self) -> *const u8[src]

Returns a raw pointer to the memory mapped file.

Safety

To safely dereference this pointer, you need to make sure that the file has not been truncated since the memory map was created.

pub fn as_mut_ptr(&self) -> *mut u8[src]

Returns an unsafe mutable pointer to the memory mapped file.

Safety

To safely dereference this pointer, you need to make sure that the file has not been truncated since the memory map was created.

pub fn len(&self) -> usize[src]

Returns the length in bytes of the memory map.

Note that truncating the file can cause the length to change (and render this value unusable).

Trait Implementations

impl Debug for MmapRaw[src]

Auto Trait Implementations

impl RefUnwindSafe for MmapRaw

impl Send for MmapRaw

impl Sync for MmapRaw

impl Unpin for MmapRaw

impl UnwindSafe for MmapRaw

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, 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.