Skip to main content

FileSystemManager

Struct FileSystemManager 

Source
pub struct FileSystemManager { /* private fields */ }

Implementations§

Source§

impl FileSystemManager

Source

pub fn new() -> Self

Source

pub async fn create_dir( &self, path: impl AsRef<Path>, create_components: bool, ) -> Result<()>

Creates a new directory

Source

pub async fn rename_dir( &mut self, from: impl AsRef<Path>, to: impl AsRef<Path>, ) -> Result<()>

Attempts to rename an entire directory.

Will fail if there is an open file within the directory on any level.

Source

pub async fn remove_dir( &mut self, path: impl AsRef<Path>, non_empty: bool, ) -> Result<()>

Attempts to remove an entire directory, failing if any file is currently open within the directory.

Source

pub async fn dir_entries( &self, path: impl AsRef<Path>, ) -> Result<Vec<LocalDirEntry>>

Retrieves all entries within the directory path.

This is a non-recursive operation, meaning that it will only yield the immediate directory entires and not walk through subdirectories or follow symlinks.

Will yield an error if there are complications with reading the directory and its entries.

Source

pub async fn open_file( &mut self, path: impl AsRef<Path>, create: bool, write: bool, read: bool, ) -> Result<LocalFileHandle>

Opens a file, creating it if create true, using write and read for permissions.

If the file is already open, will return the existing instance. If permissions differ where the returned file does not have read/write access and the request asks for it, the current instance of the file will be closed and a new instance with the same id will be opened with the new permissions where existing and requested permissions align.

Source

pub fn close_file(&mut self, handle: LocalFileHandle) -> Result<LocalFile>

Closes an open file by handle.

Will fail if no file with handle id is open, or if the signature on the file is different than that of handle.

Source

pub async fn rename_file( &mut self, from: impl AsRef<Path>, to: impl AsRef<Path>, ) -> Result<()>

Attempts to rename a file at from into to.

Will fail if file is open at from.

Source

pub async fn remove_file(&mut self, path: impl AsRef<Path>) -> Result<()>

Attempts to remove a file, failing if the file is currently open.

Source

pub fn file_cnt(&self) -> usize

Represents the total files that are open within the manager

Source

pub fn get_mut(&mut self, id: impl Into<u32>) -> Option<&mut LocalFile>

Looks up an open file by its associated id

Source

pub fn get(&self, id: impl Into<u32>) -> Option<&LocalFile>

Looks up an open file by its associated id

Source

pub fn exists(&self, id: impl Into<u32>) -> bool

Determines if a file is open with the specified id

Trait Implementations§

Source§

impl Debug for FileSystemManager

Source§

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

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

impl Default for FileSystemManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V