pub trait FileSystemOperations:
FileOperations
+ DirectoryOperations
+ MountOperations {
// Required methods
fn lookup_directory(&self, context: &mut Context, path: &Path) -> Result<()>;
fn lookup_file(
&self,
context: &mut Context,
path: &Path,
flags: Flags,
) -> Result<()>;
fn create_directory(&self, path: &Path) -> Result<()>;
fn create_file(&self, path: &Path) -> Result<()>;
fn remove(&self, path: &Path) -> Result<()>;
fn rename(&self, source: &Path, destination: &Path) -> Result<()>;
fn get_attributes(
&self,
path: &Path,
attributes: &mut Attributes,
) -> Result<()>;
fn set_attributes(&self, path: &Path, attributes: &Attributes) -> Result<()>;
}Required Methods§
fn lookup_directory(&self, context: &mut Context, path: &Path) -> Result<()>
fn lookup_file( &self, context: &mut Context, path: &Path, flags: Flags, ) -> Result<()>
fn create_directory(&self, path: &Path) -> Result<()>
fn create_file(&self, path: &Path) -> Result<()>
Sourcefn remove(&self, path: &Path) -> Result<()>
fn remove(&self, path: &Path) -> Result<()>
Remove a file or directory from the file system.
Permanently deletes the specified file or directory. For directories, they must be empty before they can be removed.
§Arguments
context- File system contextpath- Path to the file or directory to remove
§Returns
Ok(())- File or directory successfully removedErr(Error)- Error during removal
§Errors
crate::Error::NotFound- File or directory doesn’t existcrate::Error::PermissionDenied- Insufficient permissionscrate::Error::DirectoryNotEmpty- Directory contains filescrate::Error::RessourceBusy- File is currently in use
Sourcefn rename(&self, source: &Path, destination: &Path) -> Result<()>
fn rename(&self, source: &Path, destination: &Path) -> Result<()>
Rename or move a file or directory.
Changes the name or location of a file or directory. This can be used for both renaming within the same directory and moving between directories.
§Arguments
context- File system contextsource- Current path of the file or directorydestination- New path for the file or directory
§Returns
Ok(())- File or directory successfully renamed/movedErr(Error)- Error during rename operation
§Errors
crate::Error::NotFound- Source file doesn’t existcrate::Error::AlreadyExists- Destination already existscrate::Error::PermissionDenied- Insufficient permissions