Struct fatfs::Dir

source ·
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>

source

pub fn iter(&self) -> DirIter<'a, T>

Creates directory entries iterator.

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<'a, T>>

Opens existing file.

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

source

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.

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

source

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§

source§

impl<'a, T: ReadWriteSeek> Clone for Dir<'a, T>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> 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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.