pub struct Fs<S: 'static + LfsStorage> { /* private fields */ }
Implementations
sourceimpl<S: 'static + LfsStorage> Fs<S>
impl<S: 'static + LfsStorage> Fs<S>
pub fn new(fs: &'static Filesystem<'static, S>) -> Self
Methods from Deref<Target = Filesystem<'static, S>>
sourcepub fn total_blocks(&self) -> usize
pub fn total_blocks(&self) -> usize
Total number of blocks in the filesystem
sourcepub fn total_space(&self) -> usize
pub fn total_space(&self) -> usize
Total number of bytes in the filesystem
sourcepub fn available_blocks(&self) -> Result<usize, Error>
pub fn available_blocks(&self) -> Result<usize, Error>
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.
sourcepub fn available_space(&self) -> Result<usize, Error>
pub fn available_space(&self) -> Result<usize, Error>
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.
sourcepub fn remove_dir_all(&self, path: &Path) -> Result<(), Error>
pub fn remove_dir_all(&self, path: &Path) -> Result<(), Error>
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, Error> where
P: Fn(&DirEntry) -> bool,
sourcepub fn rename(&self, from: &Path, to: &Path) -> Result<(), Error>
pub fn rename(&self, from: &Path, to: &Path) -> Result<(), Error>
Rename or move a file or directory.
sourcepub fn metadata(&self, path: &Path) -> Result<Metadata, Error>
pub fn metadata(&self, path: &Path) -> Result<Metadata, Error>
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, Error>
) -> Result<R, Error>
pub fn open_file_and_then<R>(
&self,
path: &Path,
f: impl FnOnce(&File<'_, '_, Storage>) -> Result<R, Error>
) -> Result<R, Error>
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, Error>
) -> Result<R, Error>
pub fn read_dir_and_then<R>(
&self,
path: &Path,
f: impl FnOnce(&mut ReadDir<'_, '_, Storage>) -> Result<R, Error>
) -> Result<R, Error>
sourcepub fn create_dir(&self, path: &Path) -> Result<(), Error>
pub fn create_dir(&self, path: &Path) -> Result<(), Error>
Creates a new, empty directory at the provided path.
sourcepub fn create_dir_all(&self, path: &Path) -> Result<(), Error>
pub fn create_dir_all(&self, path: &Path) -> Result<(), Error>
Recursively create a directory and all of its parent components if they are missing.
Trait Implementations
sourceimpl<S: 'static + LfsStorage> Deref for Fs<S>
impl<S: 'static + LfsStorage> Deref for Fs<S>
type Target = Filesystem<'static, S>
type Target = Filesystem<'static, S>
The resulting type after dereferencing.
Auto Trait Implementations
impl<S> !RefUnwindSafe for Fs<S>
impl<S> !Send for Fs<S>
impl<S> !Sync for Fs<S>
impl<S> Unpin for Fs<S>
impl<S> !UnwindSafe for Fs<S>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more