diff options
author | Dan Burkert <dan@danburkert.com> | 2017-10-28 15:32:43 -0700 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2017-11-22 06:57:15 -0500 |
commit | 263e8f92b98ca883362c59677e23255fabfff307 (patch) | |
tree | 03ef450908e2ee7b7ffedf1529837c81cefc939f /src | |
parent | 231698f802c0c8abdb7bdfe65f9110a9c596ba63 (diff) |
Update to memmap 0.6
`memmap` 0.6.0 introduces major API changes in anticipation of a 1.0
release. See https://github.com/danburkert/memmap-rs/releases/tag/0.6.0
for more information. CC danburkert/memmap-rs#33.
Diffstat (limited to 'src')
-rw-r--r-- | src/worker.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/worker.rs b/src/worker.rs index 51b7f64c..9aa0fdc0 100644 --- a/src/worker.rs +++ b/src/worker.rs @@ -5,7 +5,7 @@ use std::path::Path; use encoding_rs::Encoding; use grep::Grep; use ignore::DirEntry; -use memmap::{Mmap, Protection}; +use memmap::Mmap; use termcolor::WriteColor; use decoder::DecodeReader; @@ -290,8 +290,8 @@ impl Worker { // regular read calls. return self.search(printer, path, file); } - let mmap = try!(Mmap::open(file, Protection::Read)); - let buf = unsafe { mmap.as_slice() }; + let mmap = unsafe { try!(Mmap::map(file)) }; + let buf = &*mmap; if buf.len() >= 3 && Encoding::for_bom(buf).is_some() { // If we have a UTF-16 bom in our memory map, then we need to fall // back to the stream reader, which will do transcoding. |