`MappedFile::new()`: changed `flags` to `impl MapFlags` to match `try_new()`

Fortune for mapped-file's current commit: Half curse − 半凶
master
Avril 2 years ago
parent aad400a458
commit eb64632841
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -130,7 +130,6 @@ pub enum HugePage {
/// The largest huge-page size on the system /// The largest huge-page size on the system
Largest, Largest,
/// Use a callback function to select the huge-page size (*in kB*) from an *ordered* (lowest to highest) enumeration of all available on the system. /// Use a callback function to select the huge-page size (*in kB*) from an *ordered* (lowest to highest) enumeration of all available on the system.
//TODO: Remember to order the HUGEPAGE_LOCATION parsing results before passing them to this!
Selected(for<'r> fn (&'r [usize]) -> Option<&'r usize>), Selected(for<'r> fn (&'r [usize]) -> Option<&'r usize>),
} }

@ -122,7 +122,7 @@ impl<T: AsRawFd> MappedFile<T> {
/// # Panics /// # Panics
/// If `mmap()` succeeds, but returns an invalid address (e.g. 0) /// If `mmap()` succeeds, but returns an invalid address (e.g. 0)
#[inline] #[inline]
pub fn new(file: T, len: usize, perm: Perm, flags: Flags) -> io::Result<Self> pub fn new(file: T, len: usize, perm: Perm, flags: impl MapFlags) -> io::Result<Self>
{ {
Self::try_new(file, len, perm, flags).map_err(Into::into) Self::try_new(file, len, perm, flags).map_err(Into::into)
} }
@ -177,8 +177,6 @@ impl<T: AsRawFd> MappedFile<T> {
} }
impl<T> MappedFile<T> { impl<T> MappedFile<T> {
#[inline(always)] #[inline(always)]
fn raw_parts(&self) -> (*mut u8, usize) fn raw_parts(&self) -> (*mut u8, usize)
{ {
@ -298,7 +296,9 @@ impl<T> MappedFile<T> {
} }
} }
/// Error returned when mapping operation fails /// Error returned when mapping operation fails.
///
/// Also returns the value passed in.
pub struct TryNewError<T: ?Sized> pub struct TryNewError<T: ?Sized>
{ {
error: Box<io::Error>, error: Box<io::Error>,

Loading…
Cancel
Save