feat: dos header的读取写完了。
This commit is contained in:
@@ -1,15 +1,12 @@
|
||||
use memmap::*;
|
||||
|
||||
// TODO: 打开文件,并将文件映射到内存
|
||||
pub fn mmap_mut_file(file_path: &str) -> Result<MmapMut, std::io::Error> {
|
||||
let file = std::fs::OpenOptions::new()
|
||||
.read(true)
|
||||
.write(true)
|
||||
.open(file_path)?;
|
||||
pub fn mmap_mut_file(file_path: &str) -> Result<Mmap, std::io::Error> {
|
||||
let file = std::fs::OpenOptions::new().read(true).open(file_path)?;
|
||||
|
||||
unsafe {
|
||||
MmapOptions::new()
|
||||
.map_mut(&file)
|
||||
.map(&file)
|
||||
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user