summaryrefslogtreecommitdiffstats
path: root/tokio/src/fs
diff options
context:
space:
mode:
authorTaiki Endo <te316e89@gmail.com>2020-10-05 00:47:35 +0900
committerGitHub <noreply@github.com>2020-10-05 00:47:35 +0900
commit0ed4127d5cab264c84e0669f4ac168eb754f8d23 (patch)
tree48bdeee0279ce5d25d4abcd3121d8734f512a059 /tokio/src/fs
parent1e585ccb516c8dc7c13cbc3d50f8ca49260b9617 (diff)
fs: seal OpenOptionsExt and DirBuilderExt (#2909)
Diffstat (limited to 'tokio/src/fs')
-rw-r--r--tokio/src/fs/os/unix/dir_builder_ext.rs9
-rw-r--r--tokio/src/fs/os/unix/open_options_ext.rs9
2 files changed, 16 insertions, 2 deletions
diff --git a/tokio/src/fs/os/unix/dir_builder_ext.rs b/tokio/src/fs/os/unix/dir_builder_ext.rs
index e9a25b95..ccdc552e 100644
--- a/tokio/src/fs/os/unix/dir_builder_ext.rs
+++ b/tokio/src/fs/os/unix/dir_builder_ext.rs
@@ -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 {}
+}
diff --git a/tokio/src/fs/os/unix/open_options_ext.rs b/tokio/src/fs/os/unix/open_options_ext.rs
index ff892758..f20c83d0 100644
--- a/tokio/src/fs/os/unix/open_options_ext.rs
+++ b/tokio/src/fs/os/unix/open_options_ext.rs
@@ -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 {}
+}