Struct ethers_solc::cache::SolFilesCache [−][src]
pub struct SolFilesCache {
pub format: String,
pub files: BTreeMap<PathBuf, CacheEntry>,
}
Expand description
A hardhat compatible cache representation
Fields
format: String
files: BTreeMap<PathBuf, CacheEntry>
Implementations
Example
Autodetect solc version and default settings
use ethers_solc::artifacts::Source;
use ethers_solc::cache::SolFilesCache;
let files = Source::read_all_from("./sources").unwrap();
let config = SolFilesCache::builder().insert_files(files, None).unwrap();
Whether this cache’s format is the hardhat format identifier
Whether this cache’s format is our custom format identifier
Reads the cache json file from the given path
pub fn get_changed_files<'a>(
&'a self,
sources: Sources,
config: Option<&'a SolcConfig>
) -> Sources
pub fn get_changed_files<'a>(
&'a self,
sources: Sources,
config: Option<&'a SolcConfig>
) -> Sources
Returns only the files that were changed from the provided sources, to save time when compiling.
Returns true if the given content hash or config differs from the file’s or the file does not exist
pub fn get_changed_or_missing_artifacts_files<'a, T: ArtifactOutput>(
&'a self,
sources: Sources,
config: Option<&'a SolcConfig>,
artifacts_root: &Path
) -> Sources
pub fn get_changed_or_missing_artifacts_files<'a, T: ArtifactOutput>(
&'a self,
sources: Sources,
config: Option<&'a SolcConfig>,
artifacts_root: &Path
) -> Sources
Returns only the files that were changed or are missing artifacts compared to previous compiler execution, to save time when compiling.
pub fn has_changed_or_missing_artifact<T: ArtifactOutput>(
&self,
file: &Path,
hash: &[u8],
config: Option<&SolcConfig>,
artifacts_root: &Path
) -> bool
pub fn has_changed_or_missing_artifact<T: ArtifactOutput>(
&self,
file: &Path,
hash: &[u8],
config: Option<&SolcConfig>,
artifacts_root: &Path
) -> bool
Returns true if the given content hash or config differs from the file’s or the file does not exist or the files’ artifacts are missing
Checks if all artifact files exist
pub fn read_artifacts<T: ArtifactOutput>(
&self,
artifacts_root: &Path
) -> Result<BTreeMap<PathBuf, T::Artifact>>
pub fn read_artifacts<T: ArtifactOutput>(
&self,
artifacts_root: &Path
) -> Result<BTreeMap<PathBuf, T::Artifact>>
Reads all cached artifacts from disk using the given ArtifactOutput handler
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for SolFilesCache
impl Send for SolFilesCache
impl Sync for SolFilesCache
impl Unpin for SolFilesCache
impl UnwindSafe for SolFilesCache
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more