pub struct FakeFilesystem { /* private fields */ }Expand description
An in-memory filesystem used by command-oriented tests.
Implementations§
Source§impl FakeFilesystem
impl FakeFilesystem
pub fn new() -> Self
pub fn create_dir(&mut self, path: impl Into<PathBuf>)
pub fn write_file( &mut self, path: impl Into<PathBuf>, contents: impl AsRef<[u8]>, )
pub fn remove_file(&mut self, path: &Path) -> bool
pub fn read_file(&self, path: &Path) -> Option<&[u8]>
pub fn read_to_string(&self, path: &Path) -> Option<String>
pub fn contains(&self, path: &Path) -> bool
pub fn files(&self) -> impl Iterator<Item = (&Path, &[u8])>
pub fn directories(&self) -> impl Iterator<Item = &Path>
pub fn save_settings(&mut self, settings: UiSettings)
pub fn settings(&self) -> Option<&UiSettings>
Sourcepub fn index_files(&self, root: &Path) -> Vec<FileEntry>
pub fn index_files(&self, root: &Path) -> Vec<FileEntry>
The runtime’s file index over the in-memory tree, minus gitignore semantics, which need a real repository.
Sourcepub fn build_attachments(
&self,
attachments: &[PromptAttachment],
) -> AttachmentOutcome
pub fn build_attachments( &self, attachments: &[PromptAttachment], ) -> AttachmentOutcome
The runtime’s attachment preparation over in-memory contents: the same pure encoding as the real reader, with reads answered from this tree.
Trait Implementations§
Source§impl Clone for FakeFilesystem
impl Clone for FakeFilesystem
Source§fn clone(&self) -> FakeFilesystem
fn clone(&self) -> FakeFilesystem
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for FakeFilesystem
impl Default for FakeFilesystem
Source§fn default() -> FakeFilesystem
fn default() -> FakeFilesystem
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for FakeFilesystem
impl RefUnwindSafe for FakeFilesystem
impl Send for FakeFilesystem
impl Sync for FakeFilesystem
impl Unpin for FakeFilesystem
impl UnsafeUnpin for FakeFilesystem
impl UnwindSafe for FakeFilesystem
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
Source§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Converts this value into a three-state builder argument.
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Converts this value into an optional builder argument.