mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-21 00:00:10 +02:00
fs: seal OpenOptionsExt and DirBuilderExt (#2909)
This commit is contained in:
@@ -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,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 {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user