pub struct DirBuilder { /* private fields */ }
Expand description
A builder for creating directories with configurable options.
For Unix-specific options, import the os::unix::fs::DirBuilderExt
trait.
This type is an async version of std::fs::DirBuilder
.
Implementations
impl DirBuilder
impl DirBuilder
pub fn new() -> DirBuilder
pub fn new() -> DirBuilder
pub fn recursive(&mut self, recursive: bool) -> &mut DirBuilder
pub fn recursive(&mut self, recursive: bool) -> &mut DirBuilder
Sets the option for recursive mode.
When set to true
, this option means all parent directories should be created recursively
if they don’t exist. Parents are created with the same permissions as the final directory.
This option is initially set to false
.
Examples
use async_std::fs::DirBuilder;
let mut builder = DirBuilder::new();
builder.recursive(true);
pub fn create<P>(&self, path: P) -> impl Future<Output = Result<(), Error>> where
P: AsRef<Path>,
pub fn create<P>(&self, path: P) -> impl Future<Output = Result<(), Error>> where
P: AsRef<Path>,
Creates a directory with the configured options.
It is considered an error if the directory already exists unless recursive mode is enabled.
Errors
An error will be returned in the following situations:
path
already points to an existing file or directory.- The current process lacks permissions to create the directory or its missing parents.
- Some other I/O error occurred.
Examples
use async_std::fs::DirBuilder;
DirBuilder::new()
.recursive(true)
.create("./some/directory")
.await?;
Trait Implementations
impl Debug for DirBuilder
impl Debug for DirBuilder
impl Default for DirBuilder
impl Default for DirBuilder
fn default() -> DirBuilder
fn default() -> DirBuilder
Returns the “default value” for a type. Read more
impl DirBuilderExt for DirBuilder
impl DirBuilderExt for DirBuilder
fn mode(&mut self, mode: u32) -> &mut DirBuilder
fn mode(&mut self, mode: u32) -> &mut DirBuilder
Sets the mode to create new directories with. This option defaults to 0o777. Read more
Auto Trait Implementations
impl RefUnwindSafe for DirBuilder
impl Send for DirBuilder
impl Sync for DirBuilder
impl Unpin for DirBuilder
impl UnwindSafe for DirBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourcefn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
T: Future, type Output = <T as Future>::Output;
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more