Skip to main content

MemoryFiles

Struct MemoryFiles 

Source
pub struct MemoryFiles(/* private fields */);
Expand description

A file system in memory, rooted at /.

Implementations§

Source§

impl MemoryFiles

Source

pub fn new() -> MemoryFiles

An empty tree with a root folder.

Source

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.

Source

pub fn with_folder(self, path: impl Into<PathBuf>) -> MemoryFiles

The same tree, holding an empty folder at path.

Source

pub fn file(&self, path: impl AsRef<Path>) -> Option<Vec<u8>>

The bytes at path, or None where nothing is.

Source

pub fn kind(&self, path: impl AsRef<Path>) -> Option<FileKind>

What is at path, as the tree holds it.

Source

pub fn set_file(&self, path: impl Into<PathBuf>, bytes: impl Into<Vec<u8>>)

Puts bytes at path, making it or replacing it.

Trait Implementations§

Source§

impl Clone for MemoryFiles

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for MemoryFiles

Source§

fn default() -> Self

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

impl Files for MemoryFiles

Source§

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

Writes bytes as the whole file at path, making it or replacing it.
Source§

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

What the file or folder at path is.
Source§

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

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

Renames from to to, which may be in another folder.
Source§

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
where *const RcInner<RefCell<Tree>> is !null: Freeze, PhantomData<RcInner<RefCell<Tree>>>: Freeze,

§

impl Move for MemoryFiles

§

impl Unpin for MemoryFiles
where Rc<RefCell<Tree>>: Unpin,

§

impl UnsafeUnpin for MemoryFiles
where *const RcInner<RefCell<Tree>> is !null: UnsafeUnpin, PhantomData<RcInner<RefCell<Tree>>>: UnsafeUnpin,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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

Source§

fn upcast(&self) -> Option<&T>