Struct memmap::MmapViewSync
[−]
[src]
pub struct MmapViewSync { // some fields omitted }
A thread-safe view of a memory map.
The view may be split into disjoint ranges, each of which will share the underlying memory map.
Methods
impl MmapViewSync
[src]
fn split_at(self, offset: usize) -> Result<(MmapViewSync, MmapViewSync)>
Split the view into disjoint pieces at the specified offset.
The provided offset must be less than the view's length.
fn restrict(&mut self, offset: usize, len: usize) -> Result<()>
Restricts the range of this view to the provided offset and length.
The provided range must be a subset of the current range (offset + len < view.len()
).
fn flush(&self) -> Result<()>
Flushes outstanding view modifications to disk.
When this returns with a non-error result, all outstanding changes to a file-backed memory map view are guaranteed to be durably stored. The file's metadata (including last modification timestamp) may not be updated.
fn flush_async(&self) -> Result<()>
Asynchronously flushes outstanding memory map view modifications to disk.
This method initiates flushing modified pages to durable storage, but it will not wait for the operation to complete before returning. The file's metadata (including last modification timestamp) may not be updated.
fn len(&self) -> usize
Returns the length of the memory map view.
fn ptr(&self) -> *const u8
Returns a shared pointer to the mapped memory.
See Mmap::as_slice
for invariants that must hold when dereferencing the pointer.
fn mut_ptr(&mut self) -> *mut u8
Returns a mutable pointer to the mapped memory.
See Mmap::as_mut_slice
for invariants that must hold when dereferencing the pointer.
unsafe fn as_slice(&self) -> &[u8]
Returns the memory mapped file as an immutable slice.
Unsafety
The caller must ensure that the file is not concurrently modified.
unsafe fn as_mut_slice(&mut self) -> &mut [u8]
Returns the memory mapped file as a mutable slice.
Unsafety
The caller must ensure that the file is not concurrently accessed.
unsafe fn clone(&self) -> MmapViewSync
Clones the view of the memory map.
The underlying memory map is shared, and thus the caller must ensure that the memory underlying the view is not illegally aliased.