fatfs

Struct 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>

§

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>,

Source§

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>,

Source§

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.