Struct devela::_libstd::fs::DirBuilder
1.6.0 · source · pub struct DirBuilder { /* private fields */ }
Expand description
A builder used to create directories in various manners.
This builder also supports platform-specific options.
Implementations§
source§impl DirBuilder
impl DirBuilder
1.6.0 · sourcepub fn new() -> DirBuilder
pub fn new() -> DirBuilder
Creates a new set of options with default mode/security settings for all platforms and also non-recursive.
§Examples
use std::fs::DirBuilder;
let builder = DirBuilder::new();
1.6.0 · sourcepub fn recursive(&mut self, recursive: bool) -> &mut DirBuilder
pub fn recursive(&mut self, recursive: bool) -> &mut DirBuilder
Indicates that directories should be created recursively, creating all parent directories. Parents that do not exist are created with the same security and permissions settings.
This option defaults to false
.
§Examples
use std::fs::DirBuilder;
let mut builder = DirBuilder::new();
builder.recursive(true);
1.6.0 · sourcepub fn create<P>(&self, path: P) -> Result<(), Error>
pub fn create<P>(&self, path: P) -> Result<(), Error>
Creates the specified directory with the options configured in this builder.
It is considered an error if the directory already exists unless recursive mode is enabled.
§Examples
use std::fs::{self, DirBuilder};
let path = "/tmp/foo/bar/baz";
DirBuilder::new()
.recursive(true)
.create(path).unwrap();
assert!(fs::metadata(path).unwrap().is_dir());
Trait Implementations§
1.6.0 · source§impl Debug for DirBuilder
impl Debug for DirBuilder
1.6.0 · source§impl DirBuilderExt for DirBuilder
impl DirBuilderExt for DirBuilder
Auto Trait Implementations§
impl Freeze for DirBuilder
impl RefUnwindSafe for DirBuilder
impl Send for DirBuilder
impl Sync for DirBuilder
impl Unpin for DirBuilder
impl UnwindSafe for DirBuilder
Blanket Implementations§
source§impl<T> Also for T
impl<T> Also for T
source§impl<T, Res> Apply<Res> for Twhere
T: ?Sized,
impl<T, Res> Apply<Res> for Twhere
T: ?Sized,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> ByteSized for T
impl<T> ByteSized for T
source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
The alignment of this type in bytes.
source§const LITTLE_ENDIAN: bool = true
const LITTLE_ENDIAN: bool = true
True if the system’s architecture is little-endian.
source§const BIG_ENDIAN: bool = false
const BIG_ENDIAN: bool = false
True if the system’s architecture is big-endian.
source§fn byte_align(&self) -> usize ⓘ
fn byte_align(&self) -> usize ⓘ
Returns the alignment of this type in bytes.
source§impl<T> ExtAny for T
impl<T> ExtAny for T
source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
source§impl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem for Twhere
T: ?Sized,
source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Know whether dropping values of this type matters, in compile-time.
source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
Returns
true
if dropping values of this type matters. Read moresource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
Forgets about
self
without running its destructor. Read moresource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
source§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
Available on crate feature
unsafe_slice
only.