pub struct MemoryFiles(/* private fields */);Expand description
A file system in memory, rooted at /.
Implementations§
Source§impl MemoryFiles
impl MemoryFiles
Sourcepub fn new() -> MemoryFiles
pub fn new() -> MemoryFiles
An empty tree with a root folder.
Sourcepub fn with_file(
self,
path: impl Into<PathBuf>,
bytes: impl Into<Vec<u8>>,
) -> MemoryFiles
pub fn with_file( self, path: impl Into<PathBuf>, bytes: impl Into<Vec<u8>>, ) -> MemoryFiles
The same tree, holding bytes at path, and the folders above it where they lack.
Sourcepub fn with_folder(self, path: impl Into<PathBuf>) -> MemoryFiles
pub fn with_folder(self, path: impl Into<PathBuf>) -> MemoryFiles
The same tree, holding an empty folder at path.
Sourcepub fn file(&self, path: impl AsRef<Path>) -> Option<Vec<u8>>
pub fn file(&self, path: impl AsRef<Path>) -> Option<Vec<u8>>
The bytes at path, or None where nothing is.
Trait Implementations§
Source§impl Clone for MemoryFiles
impl Clone for MemoryFiles
Source§impl Default for MemoryFiles
impl Default for MemoryFiles
Source§impl Files for MemoryFiles
impl Files for MemoryFiles
Source§fn read(&self, path: &Path) -> ReadFileFuture
fn read(&self, path: &Path) -> ReadFileFuture
The whole file at
path, as Flutter’s XFile.readAsBytes reads it.Source§fn 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.Source§fn 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.Source§fn metadata(&self, path: &Path) -> FileMetadataFuture
fn metadata(&self, path: &Path) -> FileMetadataFuture
What the file or folder at
path is.Source§fn list(&self, path: &Path) -> ListFilesFuture
fn list(&self, path: &Path) -> ListFilesFuture
What is in the folder at
path, in no particular order.Source§fn 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.Source§fn 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.Source§fn 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.Auto Trait Implementations§
impl !RefUnwindSafe for MemoryFiles
impl !Send for MemoryFiles
impl !Sync for MemoryFiles
impl !UnwindSafe for MemoryFiles
impl Forget for MemoryFiles
impl Freeze for MemoryFiles
impl Move for MemoryFiles
impl Unpin for MemoryFiles
impl UnsafeUnpin for MemoryFileswhere
*const RcInner<RefCell<Tree>> is !null: UnsafeUnpin,
PhantomData<RcInner<RefCell<Tree>>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more