pub struct Dir<'a, T: ReadWriteSeek + 'a> { /* private fields */ }
Expand description
A FAT filesystem directory.
This struct is created by the open_dir
or create_dir
methods on Dir
.
The root directory is returned by the root_dir
method on FileSystem
.
Implementations§
source§impl<'a, T: ReadWriteSeek + 'a> Dir<'a, T>
impl<'a, T: ReadWriteSeek + 'a> Dir<'a, T>
sourcepub fn open_dir(&self, path: &str) -> Result<Self>
pub fn open_dir(&self, path: &str) -> Result<Self>
Opens existing subdirectory.
path
is a ‘/’ separated directory path relative to self directory.
sourcepub fn open_file(&self, path: &str) -> Result<File<'a, T>>
pub fn open_file(&self, path: &str) -> Result<File<'a, T>>
Opens existing file.
path
is a ‘/’ separated file path relative to self directory.
sourcepub fn create_file(&self, path: &str) -> Result<File<'a, T>>
pub fn create_file(&self, path: &str) -> Result<File<'a, T>>
Creates new or opens existing file=.
path
is a ‘/’ separated file path relative to self directory.
File is never truncated when opening. It can be achieved by calling File::truncate
method after opening.
sourcepub fn create_dir(&self, path: &str) -> Result<Self>
pub fn create_dir(&self, path: &str) -> Result<Self>
Creates new directory or opens existing.
path
is a ‘/’ separated path relative to self directory.
sourcepub fn remove(&self, path: &str) -> Result<()>
pub fn remove(&self, path: &str) -> Result<()>
Removes existing file or directory.
path
is a ‘/’ separated file path relative to self directory.
Make sure there is no reference to this file (no File instance) or filesystem corruption
can happen.
sourcepub fn rename(
&self,
src_path: &str,
dst_dir: &Dir<'_, T>,
dst_path: &str,
) -> Result<()>
pub fn rename( &self, src_path: &str, dst_dir: &Dir<'_, T>, dst_path: &str, ) -> Result<()>
Renames or moves existing file or directory.
src_path
is a ‘/’ separated source file path relative to self directory.
dst_path
is a ‘/’ separated destination file path relative to dst_dir
.
dst_dir
can be set to self directory if rename operation without moving is needed.
Make sure there is no reference to this file (no File instance) or filesystem corruption
can happen.
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> Freeze for Dir<'a, T>
impl<'a, T> !RefUnwindSafe for Dir<'a, T>
impl<'a, T> !Send for Dir<'a, T>
impl<'a, T> !Sync for Dir<'a, T>
impl<'a, T> Unpin for Dir<'a, T>
impl<'a, T> !UnwindSafe for Dir<'a, T>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)