pub struct MapFs { /* private fields */ }Expand description
An in-memory filesystem: relative, slash-separated paths to content.
Directories are implied by the keys, so MapFs::from([("a/b.jsonic", "x:1")]) has a directory a. This is the hermetic resolver the
tests use, and the shape a caller supplies to sandbox a parse to
content it has already vetted.
Implementations§
Source§impl MapFs
impl MapFs
Sourcepub fn insert(
&mut self,
path: impl AsRef<str>,
content: impl Into<String>,
) -> &mut Self
pub fn insert( &mut self, path: impl AsRef<str>, content: impl Into<String>, ) -> &mut Self
Add one file, replacing any file already at that path.
Trait Implementations§
Source§impl<K, V> FromIterator<(K, V)> for MapFs
impl<K, V> FromIterator<(K, V)> for MapFs
Source§impl SourceFs for MapFs
impl SourceFs for MapFs
Source§fn read_file(&self, path: &str) -> Option<String>
fn read_file(&self, path: &str) -> Option<String>
Read the file at a canonical path.
None means it is not there,
or cannot be read, which resolution treats the same way.Source§fn read_dir(&self, path: &str) -> Option<Vec<DirEntry>>
fn read_dir(&self, path: &str) -> Option<Vec<DirEntry>>
List a directory.
None means it is not there or is unreadable.Auto Trait Implementations§
impl Freeze for MapFs
impl RefUnwindSafe for MapFs
impl Send for MapFs
impl Sync for MapFs
impl Unpin for MapFs
impl UnsafeUnpin for MapFs
impl UnwindSafe for MapFs
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