fs: seal OpenOptionsExt and DirBuilderExt (#2909)

This commit is contained in:
Taiki Endo
2020-10-05 00:47:35 +09:00
committed by GitHub
parent 1e585ccb51
commit 0ed4127d5c
2 changed files with 16 additions and 2 deletions
+8 -1
View File
@@ -3,7 +3,7 @@ use crate::fs::dir_builder::DirBuilder;
/// Unix-specific extensions to [`DirBuilder`].
///
/// [`DirBuilder`]: crate::fs::DirBuilder
pub trait DirBuilderExt {
pub trait DirBuilderExt: sealed::Sealed {
/// Sets the mode to create new directories with.
///
/// This option defaults to 0o777.
@@ -27,3 +27,10 @@ impl DirBuilderExt for DirBuilder {
self
}
}
impl sealed::Sealed for DirBuilder {}
pub(crate) mod sealed {
#[doc(hidden)]
pub trait Sealed {}
}
+8 -1
View File
@@ -8,7 +8,7 @@ use std::os::unix::fs::OpenOptionsExt as StdOpenOptionsExt;
///
/// [`fs::OpenOptions`]: crate::fs::OpenOptions
/// [`std::os::unix::fs::OpenOptionsExt`]: std::os::unix::fs::OpenOptionsExt
pub trait OpenOptionsExt {
pub trait OpenOptionsExt: sealed::Sealed {
/// Sets the mode bits that a new file will be created with.
///
/// If a new file is created as part of an `OpenOptions::open` call then this
@@ -77,3 +77,10 @@ impl OpenOptionsExt for OpenOptions {
self
}
}
impl sealed::Sealed for OpenOptions {}
pub(crate) mod sealed {
#[doc(hidden)]
pub trait Sealed {}
}