pub struct Dir(/* private fields */);Implementations§
Source§impl Dir
impl Dir
Sourcepub fn new<P>(root: P) -> Result<Self>
pub fn new<P>(root: P) -> Result<Self>
Creates a new Dir instance.
If the root directory does not exist, it will be created.
Sourcepub fn new_readonly<P>(root: P) -> Self
pub fn new_readonly<P>(root: P) -> Self
Creates a new Dir without creating the root directory tree
pub fn path(&self) -> &Path
pub fn create_if_not_exists(&self) -> Result<()>
pub fn create_dir_all<P: AsRef<Path>>(&self, rel_path: P) -> Result<()>
pub fn remove_file<P: AsRef<Path>>(&self, rel_path: P) -> Result<()>
pub fn file<P: AsRef<Path>>(&self, rel_path: P) -> FileBuilder
pub fn unnamed_file(&self) -> UnnamedFileBuilder
Sourcepub fn subdir_readonly<P: AsRef<Path>>(&self, rel_path: P) -> Self
pub fn subdir_readonly<P: AsRef<Path>>(&self, rel_path: P) -> Self
Creates Dir instance for a subdirectory of the current one.
Note: The subdirectory will not be created if it does not exist.
Use create_subdir to create it.
Sourcepub fn create_subdir<P: AsRef<Path>>(&self, rel_path: P) -> Result<Self>
pub fn create_subdir<P: AsRef<Path>>(&self, rel_path: P) -> Result<Self>
Creates Dir instance for a subdirectory of the current one.
The subdirectory will be created if it does not exist.
pub fn file_exists<P: AsRef<Path>>(&self, rel_path: P) -> bool
pub fn entries(&self) -> Result<ReadDir>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Dir
impl RefUnwindSafe for Dir
impl Send for Dir
impl Sync for Dir
impl Unpin for Dir
impl UnsafeUnpin for Dir
impl UnwindSafe for Dir
Blanket Implementations§
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more