GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Docs.rs
  • memmap2-0.9.12
  • Platform
  • x86_64-unknown-linux-gnu
  • Feature flags
  • About docs.rs
  • Badges
  • Builds
  • Metadata
  • Shorthand URLs
  • Download
  • Rustdoc JSON
  • Build queue
  • Privacy policy

This view

  • Original page
  • New address

GeezerVison is showing docs.rs — memmap2 - Rust

Crate memmap2 

Source
Expand description

A cross-platform Rust API for memory mapped buffers.

The core functionality is provided by either Mmap or MmapMut, which correspond to mapping a File to a &[u8] or &mut [u8] respectively. Both function by dereferencing to a slice, allowing the Mmap/MmapMut to be used in the same way you would the equivalent slice types.

§Examples

For simple cases Mmap can be used directly:

use std::fs::File;
use std::io::Read;

use memmap2::Mmap;

let mut file = File::open("LICENSE-APACHE")?;

let mut contents = Vec::new();
file.read_to_end(&mut contents)?;

let mmap = unsafe { Mmap::map(&file)?  };

assert_eq!(&contents[..], &mmap[..]);

However for cases which require configuration of the mapping, then you can use MmapOptions in order to further configure a mapping before you create it.

Structs§

MapIfSafeError
Error returned by MmapOptions::map_if_safe().
Mmap
A handle to an immutable memory mapped buffer.
MmapMut
A handle to a mutable memory mapped buffer.
MmapOptions
A memory map builder, providing advanced options and flags for specifying memory map behavior.
MmapRaw
A handle to a raw memory mapped buffer.
MmapRawDescriptor
RemapOptions
Options for Mmap::remap and MmapMut::remap.

Enums§

Advice
Values supported by Mmap::advise and MmapMut::advise functions.
UncheckedAdvice
Values supported by Mmap::unchecked_advise and MmapMut::unchecked_advise functions.

Traits§

MmapAsRawDesc
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.