Struct deno_fs::InMemoryFs
source · pub struct InMemoryFs { /* private fields */ }
Expand description
A very basic in-memory file system useful for swapping out in the place of a RealFs for testing purposes.
Please develop this out as you need functionality.
Implementations§
source§impl InMemoryFs
impl InMemoryFs
pub fn setup_text_files(&self, files: Vec<(String, String)>)
Trait Implementations§
source§impl Debug for InMemoryFs
impl Debug for InMemoryFs
source§impl Default for InMemoryFs
impl Default for InMemoryFs
source§fn default() -> InMemoryFs
fn default() -> InMemoryFs
Returns the “default value” for a type. Read more
source§impl FileSystem for InMemoryFs
impl FileSystem for InMemoryFs
fn cwd(&self) -> FsResult<PathBuf>
fn tmp_dir(&self) -> FsResult<PathBuf>
fn chdir(&self, _path: &Path) -> FsResult<()>
fn umask(&self, _mask: Option<u32>) -> FsResult<u32>
fn open_sync( &self, _path: &Path, _options: OpenOptions, _access_check: Option<AccessCheckCb<'_>> ) -> FsResult<Rc<dyn File>>
fn open_async<'a, 'async_trait>(
&'a self,
path: PathBuf,
options: OpenOptions,
access_check: Option<AccessCheckCb<'a>>
) -> Pin<Box<dyn Future<Output = FsResult<Rc<dyn File>>> + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn mkdir_sync(&self, path: &Path, recursive: bool, _mode: u32) -> FsResult<()>
fn mkdir_async<'life0, 'async_trait>(
&'life0 self,
path: PathBuf,
recursive: bool,
mode: u32
) -> Pin<Box<dyn Future<Output = FsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn chmod_sync(&self, _path: &Path, _mode: u32) -> FsResult<()>
fn chmod_async<'life0, 'async_trait>(
&'life0 self,
path: PathBuf,
mode: u32
) -> Pin<Box<dyn Future<Output = FsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn chown_sync( &self, _path: &Path, _uid: Option<u32>, _gid: Option<u32> ) -> FsResult<()>
fn chown_async<'life0, 'async_trait>(
&'life0 self,
path: PathBuf,
uid: Option<u32>,
gid: Option<u32>
) -> Pin<Box<dyn Future<Output = FsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn remove_sync(&self, _path: &Path, _recursive: bool) -> FsResult<()>
fn remove_async<'life0, 'async_trait>(
&'life0 self,
path: PathBuf,
recursive: bool
) -> Pin<Box<dyn Future<Output = FsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn copy_file_sync(&self, _from: &Path, _to: &Path) -> FsResult<()>
fn copy_file_async<'life0, 'async_trait>(
&'life0 self,
from: PathBuf,
to: PathBuf
) -> Pin<Box<dyn Future<Output = FsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn cp_sync(&self, _from: &Path, _to: &Path) -> FsResult<()>
fn cp_async<'life0, 'async_trait>(
&'life0 self,
from: PathBuf,
to: PathBuf
) -> Pin<Box<dyn Future<Output = FsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stat_sync(&self, path: &Path) -> FsResult<FsStat>
fn stat_async<'life0, 'async_trait>(
&'life0 self,
path: PathBuf
) -> Pin<Box<dyn Future<Output = FsResult<FsStat>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn lstat_sync(&self, _path: &Path) -> FsResult<FsStat>
fn lstat_async<'life0, 'async_trait>(
&'life0 self,
path: PathBuf
) -> Pin<Box<dyn Future<Output = FsResult<FsStat>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn realpath_sync(&self, _path: &Path) -> FsResult<PathBuf>
fn realpath_async<'life0, 'async_trait>(
&'life0 self,
path: PathBuf
) -> Pin<Box<dyn Future<Output = FsResult<PathBuf>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_dir_sync(&self, _path: &Path) -> FsResult<Vec<FsDirEntry>>
fn read_dir_async<'life0, 'async_trait>(
&'life0 self,
path: PathBuf
) -> Pin<Box<dyn Future<Output = FsResult<Vec<FsDirEntry>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn rename_sync(&self, _oldpath: &Path, _newpath: &Path) -> FsResult<()>
fn rename_async<'life0, 'async_trait>(
&'life0 self,
oldpath: PathBuf,
newpath: PathBuf
) -> Pin<Box<dyn Future<Output = FsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn link_sync(&self, _oldpath: &Path, _newpath: &Path) -> FsResult<()>
fn link_async<'life0, 'async_trait>(
&'life0 self,
oldpath: PathBuf,
newpath: PathBuf
) -> Pin<Box<dyn Future<Output = FsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn symlink_sync( &self, _oldpath: &Path, _newpath: &Path, _file_type: Option<FsFileType> ) -> FsResult<()>
fn symlink_async<'life0, 'async_trait>(
&'life0 self,
oldpath: PathBuf,
newpath: PathBuf,
file_type: Option<FsFileType>
) -> Pin<Box<dyn Future<Output = FsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_link_sync(&self, _path: &Path) -> FsResult<PathBuf>
fn read_link_async<'life0, 'async_trait>(
&'life0 self,
path: PathBuf
) -> Pin<Box<dyn Future<Output = FsResult<PathBuf>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn truncate_sync(&self, _path: &Path, _len: u64) -> FsResult<()>
fn truncate_async<'life0, 'async_trait>(
&'life0 self,
path: PathBuf,
len: u64
) -> Pin<Box<dyn Future<Output = FsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn utime_sync( &self, _path: &Path, _atime_secs: i64, _atime_nanos: u32, _mtime_secs: i64, _mtime_nanos: u32 ) -> FsResult<()>
fn utime_async<'life0, 'async_trait>(
&'life0 self,
path: PathBuf,
atime_secs: i64,
atime_nanos: u32,
mtime_secs: i64,
mtime_nanos: u32
) -> Pin<Box<dyn Future<Output = FsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn write_file_sync( &self, path: &Path, options: OpenOptions, _access_check: Option<AccessCheckCb<'_>>, data: &[u8] ) -> FsResult<()>
fn write_file_async<'a, 'async_trait>(
&'a self,
path: PathBuf,
options: OpenOptions,
access_check: Option<AccessCheckCb<'a>>,
data: Vec<u8>
) -> Pin<Box<dyn Future<Output = FsResult<()>> + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn read_file_sync( &self, path: &Path, _access_check: Option<AccessCheckCb<'_>> ) -> FsResult<Vec<u8>>
fn read_file_async<'a, 'async_trait>(
&'a self,
path: PathBuf,
access_check: Option<AccessCheckCb<'a>>
) -> Pin<Box<dyn Future<Output = FsResult<Vec<u8>>> + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn is_file_sync(&self, path: &Path) -> bool
fn is_dir_sync(&self, path: &Path) -> bool
fn exists_sync(&self, path: &Path) -> bool
fn read_text_file_sync( &self, path: &Path, access_check: Option<AccessCheckCb<'_>> ) -> FsResult<String>
fn read_text_file_async<'a, 'async_trait>(
&'a self,
path: PathBuf,
access_check: Option<AccessCheckCb<'a>>
) -> Pin<Box<dyn Future<Output = FsResult<String>> + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
Auto Trait Implementations§
impl !Freeze for InMemoryFs
impl !RefUnwindSafe for InMemoryFs
impl Send for InMemoryFs
impl Sync for InMemoryFs
impl Unpin for InMemoryFs
impl UnwindSafe for InMemoryFs
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<T> FmtForward for T
impl<T> FmtForward for T
source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self
to use its Binary
implementation when Debug
-formatted.source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self
to use its Display
implementation when
Debug
-formatted.source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self
to use its LowerExp
implementation when
Debug
-formatted.source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self
to use its LowerHex
implementation when
Debug
-formatted.source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self
to use its Octal
implementation when Debug
-formatted.source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self
to use its Pointer
implementation when
Debug
-formatted.source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self
to use its UpperExp
implementation when
Debug
-formatted.source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self
to use its UpperHex
implementation when
Debug
-formatted.source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> R
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self
, then passes self.deref()
into the pipe function.source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut()
only in debug builds, and is erased in release
builds.source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref()
only in debug builds, and is erased in release
builds.