Struct FileSystem

Source
pub struct FileSystem<S>
where S: Read + Write + Seek,
{ /* private fields */ }
Expand description

An API to process a FAT filesystem

Implementations§

Source§

impl<S> FileSystem<S>
where S: Read + Write + Seek,

Getter functions

Source

pub fn fat_type(&self) -> FATType

What is the FATType of the filesystem

Source§

impl<S> FileSystem<S>
where S: Read + Write + Seek,

Public functions

Source

pub fn from_storage(storage: S) -> FSResult<Self, S::Error>

Create a FileSystem from a storage object that implements Read, Write & Seek

Fails if the storage is way too small to support a FAT filesystem. For most use cases, that shouldn’t be an issue, you can just call .unwrap()

Source

pub fn read_dir(&mut self, path: PathBuf) -> FSResult<Vec<DirEntry>, S::Error>

Read all the entries of a directory (PathBuf) into Vec<DirEntry>

Fails if path doesn’t represent a directory, or if that directory doesn’t exist

Source

pub fn get_file(&mut self, path: PathBuf) -> FSResult<File<'_, S>, S::Error>

Get a corresponding File object from a PathBuf

Borrows &mut self until that File object is dropped, effectively locking self until that file closed

Fails if path doesn’t represent a file, or if that file doesn’t exist

Trait Implementations§

Source§

impl<S> Debug for FileSystem<S>
where S: Read + Write + Seek + Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> Freeze for FileSystem<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for FileSystem<S>
where S: RefUnwindSafe,

§

impl<S> Send for FileSystem<S>
where S: Send,

§

impl<S> Sync for FileSystem<S>
where S: Sync,

§

impl<S> Unpin for FileSystem<S>
where S: Unpin,

§

impl<S> UnwindSafe for FileSystem<S>
where S: UnwindSafe,

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.