fix safety hint
This commit is contained in:
+2
-2
@@ -3,11 +3,11 @@ use memmap2::MmapOptions;
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let file = std::fs::File::open("measurements.txt").unwrap();
|
let file = std::fs::File::open("measurements.txt").unwrap();
|
||||||
// SAFETY: we are not going to modify the file while the program is running. No lock required
|
|
||||||
// for now.
|
|
||||||
|
|
||||||
let mut datas = vec![];
|
let mut datas = vec![];
|
||||||
|
|
||||||
|
// SAFETY: we are not going to modify the file while the program is running. No lock required
|
||||||
|
// for now.
|
||||||
let mmap = unsafe { MmapOptions::new().map(&file) }.unwrap();
|
let mmap = unsafe { MmapOptions::new().map(&file) }.unwrap();
|
||||||
mmap.advise(memmap2::Advice::Sequential).unwrap();
|
mmap.advise(memmap2::Advice::Sequential).unwrap();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user