Struct fatfs::Dir

source ·
pub struct Dir<'fs, IO: ReadWriteSeek, TP, OCC> { /* 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<'fs, IO: ReadWriteSeek, TP, OCC> Dir<'fs, IO, TP, OCC>

source

pub fn iter<'a>(&'a self) -> DirIter<'a, 'fs, IO, TP, OCC>

Creates directory entries iterator.

source§

impl<'fs, IO: ReadWriteSeek, TP: TimeProvider, OCC: OemCpConverter> Dir<'fs, IO, TP, OCC>

source

pub fn set_created(&mut self, date_time: DateTime)

Set modification datetime for this directory.

source

pub fn set_accessed(&mut self, date: Date)

Set access date for this directory.

source

pub fn set_modified(&mut self, date_time: DateTime)

Set modification datetime for this directory.

source

pub fn accessed(&self) -> Date

Get the access time of this directory.

source

pub fn created(&self) -> DateTime

Get the creation time of this directory.

source

pub fn modified(&self) -> DateTime

Get the modification time of this directory.

source

pub fn open_dir(&self, path: &str) -> Result<Self>

Opens existing subdirectory.

path is a ‘/’ separated directory path relative to self directory.

source

pub fn open_file(&self, path: &str) -> Result<File<'fs, IO, TP, OCC>>

Opens existing file.

path is a ‘/’ separated file path relative to self directory.

source

pub fn create_file(&self, path: &str) -> Result<File<'fs, IO, TP, OCC>>

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.

source

pub fn create_dir(&self, path: &str) -> Result<Self>

Creates new directory or opens existing.

path is a ‘/’ separated path relative to self directory.

source

pub fn is_empty(&self) -> Result<bool>

source

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.

Unlink the given File from this directory.

Will cause filesystem corruption if the file is not actually in this directory, but continuing to use the file is legal. It will be completely removed from the filesystem once it is dropped.

Unlink the given Dir from this directory. Returns an error if the Dir is not empty.

Will cause filesystem corruption if the file is not actually in this directory. The directory’s clusters will be removed from the disk.

source

pub fn rename( &self, src_path: &str, dst_dir: &Dir<'_, IO, TP, OCC>, 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.

source

pub fn rename_over_file( &self, src_path: &str, dst_dir: &Dir<'_, IO, TP, OCC>, dst_path: &str, file: &mut File<'_, IO, TP, OCC> ) -> Result<()>

Same as rename, but supports renaming over an existing file.

source

pub fn rename_over_dir( &self, src_path: &str, dst_dir: &Dir<'_, IO, TP, OCC>, dst_path: &str, dir: &mut Dir<'_, IO, TP, OCC> ) -> Result<()>

Same as rename but supports renaming over an existing directory (which must be empty).

source

pub fn flush_dir_entry(&mut self) -> Result<()>

Flushes the directory entry in the parent if not the root.

Auto Trait Implementations§

§

impl<'fs, IO, TP, OCC> !Freeze for Dir<'fs, IO, TP, OCC>

§

impl<'fs, IO, TP, OCC> !RefUnwindSafe for Dir<'fs, IO, TP, OCC>

§

impl<'fs, IO, TP, OCC> !Send for Dir<'fs, IO, TP, OCC>

§

impl<'fs, IO, TP, OCC> !Sync for Dir<'fs, IO, TP, OCC>

§

impl<'fs, IO, TP, OCC> Unpin for Dir<'fs, IO, TP, OCC>
where IO: Seek + Write + Read,

§

impl<'fs, IO, TP, OCC> !UnwindSafe for Dir<'fs, IO, TP, OCC>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.