Made MappedFile<T> impl Send.

Added AsRef/Mut<[u8]> impl for MappedFile<T>

Fortune for mapped-file's current commit: Half blessing − 半吉
master
Avril 2 years ago
parent 6b5c791880
commit 51c64b56b0
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -2,7 +2,7 @@
name = "mapped-file" name = "mapped-file"
description = "Construct a memory mapping over any file object" description = "Construct a memory mapping over any file object"
keywords = ["unix", "mmap", "generic", "file", "fd"] keywords = ["unix", "mmap", "generic", "file", "fd"]
version = "0.0.3" version = "0.0.4"
edition = "2021" edition = "2021"
repository="https://github.com/notflan/mapped-file" repository="https://github.com/notflan/mapped-file"
license="MIT" license="MIT"

@ -57,6 +57,9 @@ use err::{
#[repr(transparent)] #[repr(transparent)]
struct MappedSlice(UniqueSlice<u8>); struct MappedSlice(UniqueSlice<u8>);
unsafe impl Send for MappedSlice{}
unsafe impl Sync for MappedSlice{}
impl ops::Drop for MappedSlice impl ops::Drop for MappedSlice
{ {
#[inline] #[inline]
@ -631,6 +634,24 @@ impl<T> BorrowMut<[u8]> for MappedFile<T>
} }
} }
impl<T> AsRef<[u8]> for MappedFile<T>
{
#[inline]
fn as_ref(&self) -> &[u8]
{
self.as_slice()
}
}
impl<T> AsMut<[u8]> for MappedFile<T>
{
#[inline]
fn as_mut(&mut self) -> &mut [u8]
{
self.as_slice_mut()
}
}
impl<T> ops::Deref for MappedFile<T> impl<T> ops::Deref for MappedFile<T>
{ {
type Target= [u8]; type Target= [u8];

Loading…
Cancel
Save