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.