Struct memmap2::MmapRaw [−][src]
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
Auto Trait Implementations
impl RefUnwindSafe for MmapRaw
[src]
impl Send for MmapRaw
[src]
impl Sync for MmapRaw
[src]
impl Unpin for MmapRaw
[src]
impl UnwindSafe for MmapRaw
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,