pub trait Files {
// Required methods
fn read(&self, path: &Path) -> ReadFileFuture;
fn write(&self, path: &Path, bytes: &[u8]) -> WriteFileFuture;
fn open(&self, path: &Path, mode: OpenMode) -> OpenFileFuture;
fn metadata(&self, path: &Path) -> FileMetadataFuture;
fn list(&self, path: &Path) -> ListFilesFuture;
fn create_folder(&self, path: &Path) -> FileOperationFuture;
fn rename(&self, from: &Path, to: &Path) -> FileOperationFuture;
fn delete(&self, path: &Path) -> FileOperationFuture;
}Expand description
The host’s file system.
Required Methods§
Sourcefn read(&self, path: &Path) -> ReadFileFuture
fn read(&self, path: &Path) -> ReadFileFuture
The whole file at path, as Flutter’s XFile.readAsBytes reads it.
Sourcefn write(&self, path: &Path, bytes: &[u8]) -> WriteFileFuture
fn write(&self, path: &Path, bytes: &[u8]) -> WriteFileFuture
Writes bytes as the whole file at path, making it or replacing it.
Sourcefn open(&self, path: &Path, mode: OpenMode) -> OpenFileFuture
fn open(&self, path: &Path, mode: OpenMode) -> OpenFileFuture
Opens path as mode says; the file reads and writes at an offset and streams.
Sourcefn metadata(&self, path: &Path) -> FileMetadataFuture
fn metadata(&self, path: &Path) -> FileMetadataFuture
What the file or folder at path is.
Sourcefn list(&self, path: &Path) -> ListFilesFuture
fn list(&self, path: &Path) -> ListFilesFuture
What is in the folder at path, in no particular order.
Sourcefn create_folder(&self, path: &Path) -> FileOperationFuture
fn create_folder(&self, path: &Path) -> FileOperationFuture
Makes an empty folder at path, and the folders above it where they are missing, as
Dart’s Directory.create(recursive: true) does. A folder already there is left as it is.
Sourcefn rename(&self, from: &Path, to: &Path) -> FileOperationFuture
fn rename(&self, from: &Path, to: &Path) -> FileOperationFuture
Renames from to to, which may be in another folder.
Sourcefn delete(&self, path: &Path) -> FileOperationFuture
fn delete(&self, path: &Path) -> FileOperationFuture
Deletes the file or folder at path. A folder is deleted with what is in it, as Dart’s
Directory.delete(recursive: true) on macOS and Linux does; a system that refuses a
non-empty folder answers that refusal.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".