pub struct MemoryFilesystem { /* private fields */ }Expand description
Files held in memory.
What a test wants: no directory to create, no cleanup to forget, and the
same Filesystem the application uses in production. It also enforces
the same path rules, so a test cannot pass with a path the local or S3
driver would refuse.
Implementations§
Trait Implementations§
Source§impl Debug for MemoryFilesystem
impl Debug for MemoryFilesystem
Source§impl Default for MemoryFilesystem
impl Default for MemoryFilesystem
Source§impl Filesystem for MemoryFilesystem
impl Filesystem for MemoryFilesystem
Source§fn get<'a>(&'a self, path: &'a str) -> BoxFuture<'a, Result<Option<Bytes>>>
fn get<'a>(&'a self, path: &'a str) -> BoxFuture<'a, Result<Option<Bytes>>>
Read a file.
None if it is not there. Read moreSource§fn put<'a>(
&'a self,
path: &'a str,
contents: Bytes,
) -> BoxFuture<'a, Result<()>>
fn put<'a>( &'a self, path: &'a str, contents: Bytes, ) -> BoxFuture<'a, Result<()>>
Write a file, creating any directories it needs and replacing what was
there.
Source§fn delete<'a>(&'a self, path: &'a str) -> BoxFuture<'a, Result<bool>>
fn delete<'a>(&'a self, path: &'a str) -> BoxFuture<'a, Result<bool>>
Delete a file.
true if it was there.Source§fn metadata<'a>(
&'a self,
path: &'a str,
) -> BoxFuture<'a, Result<Option<Metadata>>>
fn metadata<'a>( &'a self, path: &'a str, ) -> BoxFuture<'a, Result<Option<Metadata>>>
A file’s metadata, or
None.Source§fn list<'a>(&'a self, prefix: &'a str) -> BoxFuture<'a, Result<Vec<Metadata>>>
fn list<'a>(&'a self, prefix: &'a str) -> BoxFuture<'a, Result<Vec<Metadata>>>
Every file directly under
prefix, not recursing. Read moreAuto Trait Implementations§
impl !Freeze for MemoryFilesystem
impl RefUnwindSafe for MemoryFilesystem
impl Send for MemoryFilesystem
impl Sync for MemoryFilesystem
impl Unpin for MemoryFilesystem
impl UnsafeUnpin for MemoryFilesystem
impl UnwindSafe for MemoryFilesystem
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
Source§impl<F> FilesystemExt for Fwhere
F: Filesystem + ?Sized,
impl<F> FilesystemExt for Fwhere
F: Filesystem + ?Sized,
Source§fn get_string<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_string<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read a file as a string.
Source§fn put_string<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
contents: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn put_string<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
contents: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Write a string.
Source§fn get_or_fail<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_or_fail<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read a file, failing with a
404 if it is absent. Read moreSource§fn size<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn size<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
A file’s size.
Source§fn last_modified<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<DateTime<Utc>>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn last_modified<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<DateTime<Utc>>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
When a file was last written.
Source§fn append<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
contents: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn append<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
contents: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Append to a file, creating it if absent. Read more