pub struct CountingFileSystem { /* private fields */ }Expand description
Decorates the in-memory filesystem with algorithmic I/O counters. Tests assert call counts rather than elapsed time, so a loaded CI runner cannot turn a regression into a flaky budget failure.
Implementations§
Source§impl CountingFileSystem
impl CountingFileSystem
pub fn new(inner: FakeFileSystem) -> Self
pub fn read_dir_calls(&self) -> usize
pub fn read_file_calls(&self) -> usize
Trait Implementations§
Source§impl FileSystemService for CountingFileSystem
impl FileSystemService for CountingFileSystem
Source§fn read_dir(&self, path: &Path) -> FsResult<Vec<DirEntryInfo>>
fn read_dir(&self, path: &Path) -> FsResult<Vec<DirEntryInfo>>
List one directory level. Does not recurse — the tree is lazy (ADR-0005 §2). Read more
fn read_file(&self, path: &Path) -> FsResult<Vec<u8>>
Source§fn create_file(&self, path: &Path) -> FsResult<()>
fn create_file(&self, path: &Path) -> FsResult<()>
Create an empty file. Errors with
FsError::AlreadyExists rather than truncating.Source§fn write_file(&self, path: &Path, contents: &[u8]) -> FsResult<()>
fn write_file(&self, path: &Path, contents: &[u8]) -> FsResult<()>
Replace a file’s contents, creating it if absent. Read more
Source§fn create_dir(&self, path: &Path) -> FsResult<()>
fn create_dir(&self, path: &Path) -> FsResult<()>
Create a directory, including missing parents.
fn rename(&self, from: &Path, to: &Path) -> FsResult<()>
fn remove_file(&self, path: &Path) -> FsResult<()>
Auto Trait Implementations§
impl !Freeze for CountingFileSystem
impl RefUnwindSafe for CountingFileSystem
impl Send for CountingFileSystem
impl Sync for CountingFileSystem
impl Unpin for CountingFileSystem
impl UnsafeUnpin for CountingFileSystem
impl UnwindSafe for CountingFileSystem
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.