Add a cached fs abstraction (#141)

This commit is contained in:
Omar
2025-08-14 18:21:05 +03:00
committed by GitHub
parent f2045db0e9
commit a59e287fa1
11 changed files with 230 additions and 19 deletions
+7 -3
View File
@@ -2,7 +2,7 @@ use std::{
cmp::Ordering,
collections::BTreeMap,
fmt::Display,
fs::{File, read_to_string},
fs::File,
ops::Deref,
path::{Path, PathBuf},
str::FromStr,
@@ -11,7 +11,9 @@ use std::{
use serde::{Deserialize, Serialize};
use revive_common::EVMVersion;
use revive_dt_common::{iterators::FilesWithExtensionIterator, macros::define_wrapper_type};
use revive_dt_common::{
cached_fs::read_to_string, iterators::FilesWithExtensionIterator, macros::define_wrapper_type,
};
use crate::{
case::Case,
@@ -259,7 +261,9 @@ impl Metadata {
Ok(Box::new(std::iter::once(metadata_file_path.clone())))
} else {
Ok(Box::new(
FilesWithExtensionIterator::new(self.directory()?).with_allowed_extension("sol"),
FilesWithExtensionIterator::new(self.directory()?)
.with_allowed_extension("sol")
.with_use_cached_fs(true),
))
}
}