Struct ethers_solc::artifacts::CompilerInput
source · pub struct CompilerInput {
pub language: String,
pub sources: Sources,
pub settings: Settings,
}
Expand description
Input type solc
expects
Fields§
§language: String
§sources: Sources
§settings: Settings
Implementations§
source§impl CompilerInput
impl CompilerInput
sourcepub fn new(path: impl AsRef<Path>) -> Result<Vec<Self>, SolcIoError>
pub fn new(path: impl AsRef<Path>) -> Result<Vec<Self>, SolcIoError>
Reads all contracts found under the path
sourcepub fn with_sources(sources: Sources) -> Vec<Self>
pub fn with_sources(sources: Sources) -> Vec<Self>
Creates a new CompilerInputs with default settings and the given sources
A CompilerInput expects a language setting, supported by solc are solidity or yul.
In case the sources
is a mix of solidity and yul files, 2 CompilerInputs are returned
sourcepub fn sanitize(&mut self, version: &Version)
pub fn sanitize(&mut self, version: &Version)
This will remove/adjust values in the CompilerInput
that are not compatible with this
version
sourcepub fn sanitized(self, version: &Version) -> Self
pub fn sanitized(self, version: &Version) -> Self
Consumes the type and returns a CompilerInput::sanitized version
sourcepub fn evm_version(self, version: EvmVersion) -> Self
pub fn evm_version(self, version: EvmVersion) -> Self
Sets the EVM version for compilation
sourcepub fn normalize_evm_version(self, version: &Version) -> Self
pub fn normalize_evm_version(self, version: &Version) -> Self
Normalizes the EVM version used in the settings to be up to the latest one supported by the provided compiler version.
pub fn with_remappings(self, remappings: Vec<Remapping>) -> Self
sourcepub fn join_path(self, root: impl AsRef<Path>) -> Self
pub fn join_path(self, root: impl AsRef<Path>) -> Self
Sets the path of the source files to root
adjoined to the existing path
sourcepub fn strip_prefix(self, base: impl AsRef<Path>) -> Self
pub fn strip_prefix(self, base: impl AsRef<Path>) -> Self
Removes the base
path from all source files
sourcepub fn with_base_path(self, base: impl AsRef<Path>) -> Self
pub fn with_base_path(self, base: impl AsRef<Path>) -> Self
Similar to Self::strip_prefix()
. Remove a base path from all
sources and all paths in solc settings such as remappings
See also solc --base-path
sourcepub fn is_yul(&self) -> bool
pub fn is_yul(&self) -> bool
The flag indicating whether the current CompilerInput is constructed for the yul sources
Trait Implementations§
source§impl Clone for CompilerInput
impl Clone for CompilerInput
source§fn clone(&self) -> CompilerInput
fn clone(&self) -> CompilerInput
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more