Struct littlefs2::fs::Filesystem [−][src]
pub struct Filesystem<'a, Storage: Storage> { /* fields omitted */ }
Implementations
pub fn mount_and_then<R>(
storage: &mut Storage,
f: impl FnOnce(&Filesystem<'_, Storage>) -> Result<R>
) -> Result<R>
pub fn mount_and_then<R>(
storage: &mut Storage,
f: impl FnOnce(&Filesystem<'_, Storage>) -> Result<R>
) -> Result<R>
This API avoids the need for using Allocation
.
Total number of blocks in the filesystem
Total number of bytes in the filesystem
Available number of unused blocks in the filesystem
Upstream littlefs documentation notes (on its “current size” function): “Result is best effort. If files share COW structures, the returned size may be larger than the filesystem actually is.”
So it would seem that there are at least the number of blocks returned by this method available, at any given time.
Available number of unused bytes in the filesystem
This is a lower bound, more may be available. First, more blocks may be available as
explained in available_blocks
.
Second, files may be inlined.
Remove a file or directory.
TODO: This method fails if some println!
calls are removed.
Whyy?
pub fn remove_dir_all_where<P>(
&self,
path: &Path,
predicate: &P
) -> Result<usize> where
P: Fn(&DirEntry) -> bool,
Given a path, query the filesystem to get information about a file or directory.
To read user attributes, use
Filesystem::attribute
pub fn create_file_and_then<R>(
&self,
path: &Path,
f: impl FnOnce(&File<'_, '_, Storage>) -> Result<R>
) -> Result<R>
pub fn open_file_and_then<R>(
&self,
path: &Path,
f: impl FnOnce(&File<'_, '_, Storage>) -> Result<R>
) -> Result<R>
pub fn open_file_with_options_and_then<R>(
&self,
o: impl FnOnce(&mut OpenOptions) -> &OpenOptions,
path: &Path,
f: impl FnOnce(&File<'_, '_, Storage>) -> Result<R>
) -> Result<R>
Deconstruct Filesystem
, intention is to allow access to
the underlying Flash peripheral in driver::Storage etc.
See also borrow_storage_mut
.
Creates a new, empty directory at the provided path.
Recursively create a directory and all of its parent components if they are missing.
Read the entire contents of a file into a bytes vector.