diff --git a/Cargo.toml b/Cargo.toml index 0808cff..a99239f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "mapped-file" description = "Construct a memory mapping over any file object" keywords = ["unix", "mmap", "generic", "file", "fd"] -version = "0.0.3" +version = "0.0.4" edition = "2021" repository="https://github.com/notflan/mapped-file" license="MIT" diff --git a/src/lib.rs b/src/lib.rs index 28d2998..870fe31 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -57,6 +57,9 @@ use err::{ #[repr(transparent)] struct MappedSlice(UniqueSlice); +unsafe impl Send for MappedSlice{} +unsafe impl Sync for MappedSlice{} + impl ops::Drop for MappedSlice { #[inline] @@ -631,6 +634,24 @@ impl BorrowMut<[u8]> for MappedFile } } +impl AsRef<[u8]> for MappedFile +{ + #[inline] + fn as_ref(&self) -> &[u8] + { + self.as_slice() + } +} + +impl AsMut<[u8]> for MappedFile +{ + #[inline] + fn as_mut(&mut self) -> &mut [u8] + { + self.as_slice_mut() + } +} + impl ops::Deref for MappedFile { type Target= [u8];