FileSystem

Trait FileSystem 

Source
pub trait FileSystem: Sync {
Show 16 methods // Required methods fn create_file( &self, path: &str, attribute: FileAttribute, size: usize, ) -> Result<()>; fn remove_file(&self, path: &str) -> Result<()>; fn create_directory(&self, path: &str) -> Result<()>; fn remove_dir(&self, path: &str) -> Result<()>; fn remove_dir_all(&self, path: &str) -> Result<()>; fn rename_file(&self, old_path: &str, new_path: &str) -> Result<()>; fn rename_directory(&self, old_path: &str, new_path: &str) -> Result<()>; fn get_entry_type(&self, path: &str) -> Result<DirectoryEntryType>; fn open_file(&self, path: &str, mode: FileOpenMode) -> Result<Box<dyn File>>; fn open_directory( &self, path: &str, mode: DirectoryOpenMode, ) -> Result<Box<dyn Directory>>; fn commit(&self) -> Result<()>; fn get_free_space_size(&self, path: &str) -> Result<usize>; fn get_total_space_size(&self, path: &str) -> Result<usize>; fn remove_children_all(&self, path: &str) -> Result<()>; fn get_file_time_stamp_raw(&self, path: &str) -> Result<FileTimeStampRaw>; fn query_entry( &self, path: &str, query_id: QueryId, in_buf: &[u8], out_buf: &mut [u8], ) -> Result<()>;
}
Expand description

Represents a filesystem.

Required Methods§

Source

fn create_file( &self, path: &str, attribute: FileAttribute, size: usize, ) -> Result<()>

Creates a file.

§Arguments:
  • path: The file path to create.
  • size: The initial file size.
  • attribute: The file attribute flags.
Source

fn remove_file(&self, path: &str) -> Result<()>

Deletes a file.

§Arguments:
  • path: The file path to delete.
Source

fn create_directory(&self, path: &str) -> Result<()>

Creates a directory.

§Arguments.
  • path: The directory path to create.
Source

fn remove_dir(&self, path: &str) -> Result<()>

Deletes a directory.

§Arguments.
  • path: The directory path to delete.
Source

fn remove_dir_all(&self, path: &str) -> Result<()>

Deletes a directory and all its children files/directories.

§Arguments:
  • path: The directory to recursively remove.
Source

fn rename_file(&self, old_path: &str, new_path: &str) -> Result<()>

Renames a file.

§Arguments.
  • old_path: The current file name/path.
  • new_path: The new file name/path.
Source

fn rename_directory(&self, old_path: &str, new_path: &str) -> Result<()>

Renames a directory.

§Arguments.
  • old_path: The current directory path.
  • new_path: The new directory path.
Source

fn get_entry_type(&self, path: &str) -> Result<DirectoryEntryType>

Gets a path’s DirectoryEntryType.

§Arguments.
  • path: The path we are checking the entity type of.
Source

fn open_file(&self, path: &str, mode: FileOpenMode) -> Result<Box<dyn File>>

Opens a File.

§Arguments:
  • path: The file path to open.
  • mode: The open mode.
Source

fn open_directory( &self, path: &str, mode: DirectoryOpenMode, ) -> Result<Box<dyn Directory>>

Opens a Directory.

§Arguments:
  • path: The directory path to open.
  • mode: The open mode.
Source

fn commit(&self) -> Result<()>

Commits the filesystem, flushing pending writes.

Source

fn get_free_space_size(&self, path: &str) -> Result<usize>

Gets the free space size at a given path.

§Argument.
  • path: The path to check.
Source

fn get_total_space_size(&self, path: &str) -> Result<usize>

Gets the total space size at a given path.

§Arguments:
  • path: The path to use.
Source

fn remove_children_all(&self, path: &str) -> Result<()>

Deletes all the children files/directories inside a directory.

§Arguments:
  • path: The path to use.
Source

fn get_file_time_stamp_raw(&self, path: &str) -> Result<FileTimeStampRaw>

Gets the FileTimeStampRaw of a file.

§Arguments:
  • path: The path to use.
Source

fn query_entry( &self, path: &str, query_id: QueryId, in_buf: &[u8], out_buf: &mut [u8], ) -> Result<()>

Queries on a path.

§Arguments:
  • query_id: The QueryId.
  • in_buf: Input data.
  • out_buf: Output data.

Implementors§