pub struct Directory<'a, D, T, const MAX_DIRS: usize, const MAX_FILES: usize, const MAX_VOLUMES: usize>
where D: BlockDevice, T: TimeSource,
{ /* private fields */ }
Expand description

Represents an open directory on disk.

If you drop a value of this type, it closes the directory automatically. However, it holds a mutable reference to its parent VolumeManager, which restricts which operations you can perform.

Implementations§

source§

impl<'a, D, T, const MAX_DIRS: usize, const MAX_FILES: usize, const MAX_VOLUMES: usize> Directory<'a, D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES>
where D: BlockDevice, T: TimeSource,

source

pub fn new( raw_directory: RawDirectory, volume_mgr: &'a mut VolumeManager<D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES> ) -> Directory<'a, D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES>

Create a new Directory from a RawDirectory

source

pub fn open_dir<N>( &mut self, name: N ) -> Result<Directory<'_, D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES>, Error<D::Error>>
where N: ToShortFileName,

Open a directory.

You can then read the directory entries with iterate_dir and open_file_in_dir.

source

pub fn change_dir<N>(&mut self, name: N) -> Result<(), Error<D::Error>>
where N: ToShortFileName,

Change to a directory, mutating this object.

You can then read the directory entries with iterate_dir and open_file_in_dir.

source

pub fn find_directory_entry<N>( &mut self, name: N ) -> Result<DirEntry, Error<D::Error>>
where N: ToShortFileName,

Look in a directory for a named file.

source

pub fn iterate_dir<F>(&mut self, func: F) -> Result<(), Error<D::Error>>
where F: FnMut(&DirEntry),

Call a callback function for each directory entry in a directory.

source

pub fn open_file_in_dir<N>( &mut self, name: N, mode: Mode ) -> Result<File<'_, D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES>, Error<D::Error>>
where N: ToShortFileName,

Open a file with the given full path. A file can only be opened once.

source

pub fn delete_file_in_dir<N>(&mut self, name: N) -> Result<(), Error<D::Error>>
where N: ToShortFileName,

Delete a closed file with the given filename, if it exists.

source

pub fn make_dir_in_dir<N>(&mut self, name: N) -> Result<(), Error<D::Error>>
where N: ToShortFileName,

Make a directory inside this directory

source

pub fn to_raw_directory(self) -> RawDirectory

Convert back to a raw directory

Trait Implementations§

source§

impl<'a, D, T, const MAX_DIRS: usize, const MAX_FILES: usize, const MAX_VOLUMES: usize> Debug for Directory<'a, D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES>
where D: BlockDevice, T: TimeSource,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, D, T, const MAX_DIRS: usize, const MAX_FILES: usize, const MAX_VOLUMES: usize> Drop for Directory<'a, D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES>
where D: BlockDevice, T: TimeSource,

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a, D, T, const MAX_DIRS: usize, const MAX_FILES: usize, const MAX_VOLUMES: usize> RefUnwindSafe for Directory<'a, D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES>

§

impl<'a, D, T, const MAX_DIRS: usize, const MAX_FILES: usize, const MAX_VOLUMES: usize> Send for Directory<'a, D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES>
where D: Send, T: Send,

§

impl<'a, D, T, const MAX_DIRS: usize, const MAX_FILES: usize, const MAX_VOLUMES: usize> Sync for Directory<'a, D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES>
where D: Sync, T: Sync,

§

impl<'a, D, T, const MAX_DIRS: usize, const MAX_FILES: usize, const MAX_VOLUMES: usize> Unpin for Directory<'a, D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES>

§

impl<'a, D, T, const MAX_DIRS: usize, const MAX_FILES: usize, const MAX_VOLUMES: usize> !UnwindSafe for Directory<'a, D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES>

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.