Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ libc = "0.2"
winapi = { version = "0.3", features = ["basetsd", "handleapi", "memoryapi", "minwindef", "std", "sysinfoapi"] }

[dev-dependencies]
tempdir = "0.3"
tempfile = "3"
36 changes: 18 additions & 18 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,15 @@ impl MmapOptions {
///
/// ```
/// # extern crate memmap;
/// # extern crate tempdir;
/// # extern crate tempfile;
/// #
/// use std::fs::OpenOptions;
/// use std::path::PathBuf;
///
/// use memmap::MmapOptions;
/// #
/// # fn main() -> std::io::Result<()> {
/// # let tempdir = tempdir::TempDir::new("mmap")?;
/// # let tempdir = tempfile::tempdir()?;
/// let path: PathBuf = /* path to file */
/// # tempdir.path().join("map_mut");
/// let file = OpenOptions::new().read(true).write(true).create(true).open(&path)?;
Expand Down Expand Up @@ -381,15 +381,15 @@ impl Mmap {
///
/// ```
/// # extern crate memmap;
/// # extern crate tempdir;
/// # extern crate tempfile;
/// #
/// use memmap::Mmap;
/// use std::ops::DerefMut;
/// use std::io::Write;
/// # use std::fs::OpenOptions;
///
/// # fn main() -> std::io::Result<()> {
/// # let tempdir = tempdir::TempDir::new("mmap")?;
/// # let tempdir = tempfile::tempdir()?;
/// let file = /* file opened with write permissions */
/// # OpenOptions::new()
/// # .read(true)
Expand Down Expand Up @@ -481,15 +481,15 @@ impl MmapMut {
///
/// ```
/// # extern crate memmap;
/// # extern crate tempdir;
/// # extern crate tempfile;
/// #
/// use std::fs::OpenOptions;
/// use std::path::PathBuf;
///
/// use memmap::MmapMut;
/// #
/// # fn main() -> std::io::Result<()> {
/// # let tempdir = tempdir::TempDir::new("mmap")?;
/// # let tempdir = tempfile::tempdir()?;
/// let path: PathBuf = /* path to file */
/// # tempdir.path().join("map_mut");
/// let file = OpenOptions::new()
Expand Down Expand Up @@ -530,7 +530,7 @@ impl MmapMut {
///
/// ```
/// # extern crate memmap;
/// # extern crate tempdir;
/// # extern crate tempfile;
/// #
/// use std::fs::OpenOptions;
/// use std::io::Write;
Expand All @@ -539,7 +539,7 @@ impl MmapMut {
/// use memmap::MmapMut;
///
/// # fn main() -> std::io::Result<()> {
/// # let tempdir = tempdir::TempDir::new("mmap")?;
/// # let tempdir = tempfile::tempdir()?;
/// let path: PathBuf = /* path to file */
/// # tempdir.path().join("flush");
/// let file = OpenOptions::new().read(true).write(true).create(true).open(&path)?;
Expand Down Expand Up @@ -682,7 +682,7 @@ impl fmt::Debug for MmapMut {
#[cfg(test)]
mod test {

extern crate tempdir;
extern crate tempfile;
#[cfg(windows)]
extern crate winapi;

Expand All @@ -701,7 +701,7 @@ mod test {
#[test]
fn map_file() {
let expected_len = 128;
let tempdir = tempdir::TempDir::new("mmap").unwrap();
let tempdir = tempfile::tempdir().unwrap();
let path = tempdir.path().join("mmap");

let file = OpenOptions::new()
Expand Down Expand Up @@ -733,7 +733,7 @@ mod test {
/// Checks that a 0-length file will not be mapped.
#[test]
fn map_empty_file() {
let tempdir = tempdir::TempDir::new("mmap").unwrap();
let tempdir = tempfile::tempdir().unwrap();
let path = tempdir.path().join("mmap");

let file = OpenOptions::new()
Expand Down Expand Up @@ -773,7 +773,7 @@ mod test {

#[test]
fn file_write() {
let tempdir = tempdir::TempDir::new("mmap").unwrap();
let tempdir = tempfile::tempdir().unwrap();
let path = tempdir.path().join("mmap");

let mut file = OpenOptions::new()
Expand All @@ -797,7 +797,7 @@ mod test {

#[test]
fn flush_range() {
let tempdir = tempdir::TempDir::new("mmap").unwrap();
let tempdir = tempfile::tempdir().unwrap();
let path = tempdir.path().join("mmap");

let file = OpenOptions::new()
Expand All @@ -822,7 +822,7 @@ mod test {

#[test]
fn map_copy() {
let tempdir = tempdir::TempDir::new("mmap").unwrap();
let tempdir = tempfile::tempdir().unwrap();
let path = tempdir.path().join("mmap");

let mut file = OpenOptions::new()
Expand Down Expand Up @@ -858,7 +858,7 @@ mod test {

#[test]
fn map_offset() {
let tempdir = tempdir::TempDir::new("mmap").unwrap();
let tempdir = tempfile::tempdir().unwrap();
let path = tempdir.path().join("mmap");

let file = OpenOptions::new()
Expand Down Expand Up @@ -939,7 +939,7 @@ mod test {
#[test]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
fn jit_x86_file() {
let tempdir = tempdir::TempDir::new("mmap").unwrap();
let tempdir = tempfile::tempdir().unwrap();
let mut options = OpenOptions::new();
#[cfg(windows)]
options.access_mode(GENERIC_ALL);
Expand All @@ -957,7 +957,7 @@ mod test {

#[test]
fn mprotect_file() {
let tempdir = tempdir::TempDir::new("mmap").unwrap();
let tempdir = tempfile::tempdir().unwrap();
let path = tempdir.path().join("mmap");

let mut options = OpenOptions::new();
Expand Down Expand Up @@ -1003,7 +1003,7 @@ mod test {

#[test]
fn mprotect_copy() {
let tempdir = tempdir::TempDir::new("mmap").unwrap();
let tempdir = tempfile::tempdir().unwrap();
let path = tempdir.path().join("mmap");

let mut options = OpenOptions::new();
Expand Down