In version 0.5 and older of mmap-rs, Mmap was designed to take ownership of the File. Part of the reason to do this was to ensure Mmap::flush() would be synchronous on Microsoft Windows, since it needs to call FlushFileBuffers() on the file handle.
However, this complicates some planned API changes to implement Mmap::from_raw() and the ability to split memory mappings into multiple memory mappings.
This PR removes Mmap::file() that returns a reference to the File owned by the memory mapping, and changes MmapOptions to work with a reference of the file, rather than taking ownership.
Since this breaks the behavior of Mmap::flush(), the comment has been updated to inform the requirement of having to call File::sync_all() to ensure it is synchronous and actually flushes the file metadata on Microsoft Windows.
In version 0.5 and older of mmap-rs,
Mmap
was designed to take ownership of theFile
. Part of the reason to do this was to ensureMmap::flush()
would be synchronous on Microsoft Windows, since it needs to callFlushFileBuffers()
on the file handle.However, this complicates some planned API changes to implement
Mmap::from_raw()
and the ability to split memory mappings into multiple memory mappings.This PR removes
Mmap::file()
that returns a reference to theFile
owned by the memory mapping, and changesMmapOptions
to work with a reference of the file, rather than taking ownership.Since this breaks the behavior of
Mmap::flush()
, the comment has been updated to inform the requirement of having to callFile::sync_all()
to ensure it is synchronous and actually flushes the file metadata on Microsoft Windows.