diff --git a/Cargo.toml b/Cargo.toml index 331c9c5..fbb38a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ keywords = ["metrics", "async", "tracing"] default = ["runtime_thread"] gzip = ["flate2"] lz4 = ["lz4_flex"] -mmap = ["memmap"] +mmap = ["memmap2"] runtime_thread = [] [dependencies] @@ -35,4 +35,4 @@ parking_lot = "0.12" zip = { version = "0.6", optional = true } lz4_flex = { version = "0.11", optional = true } flate2 = { version = "1.0", optional = true} -memmap = { version ="0.7.0", optional = true} \ No newline at end of file +memmap2 = {version = "0.7.1", optional = true} \ No newline at end of file diff --git a/src/plugin/file_mmap.rs b/src/plugin/file_mmap.rs index 1d327f5..486ef2d 100644 --- a/src/plugin/file_mmap.rs +++ b/src/plugin/file_mmap.rs @@ -1,7 +1,7 @@ use crate::consts::LogSize; use crate::error::LogError; use crate::plugin::file_split::SplitFile; -use memmap::{MmapMut, MmapOptions}; +use memmap2::{MmapMut, MmapOptions}; use std::cell::{RefCell, UnsafeCell}; use std::fs::{File, OpenOptions}; use std::io::{SeekFrom, Write}; @@ -21,7 +21,7 @@ impl MmapFile { let log_file_path = log_file_path.replace("\\", "/"); if let Some(right) = log_file_path.rfind("/") { let path = &log_file_path[0..right]; - let _= std::fs::create_dir_all(path); + let _ = std::fs::create_dir_all(path); } let file = OpenOptions::new() .write(true) @@ -136,7 +136,7 @@ impl SplitFile for MmapFile { file.set_len(self.size.get_len() as u64)?; let mmap = unsafe { MmapOptions::new() - .map(&file) + .map(&*file) .map_err(|e| { std::io::Error::new( std::io::ErrorKind::InvalidInput, @@ -151,7 +151,7 @@ impl SplitFile for MmapFile { } fn flush(&self) { - let _= self.bytes.borrow_mut().flush(); + let _ = self.bytes.borrow_mut().flush(); } fn len(&self) -> usize {