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 moreSource§impl Debug for CompilerInput
impl Debug for CompilerInput
Source§impl<'de> Deserialize<'de> for CompilerInput
impl<'de> Deserialize<'de> for CompilerInput
Source§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>,
Source§impl From<CompilerInput> for StandardJsonCompilerInput
impl From<CompilerInput> for StandardJsonCompilerInput
Source§fn from(input: CompilerInput) -> Self
fn from(input: CompilerInput) -> Self
Source§impl From<StandardJsonCompilerInput> for CompilerInput
impl From<StandardJsonCompilerInput> for CompilerInput
Source§fn from(input: StandardJsonCompilerInput) -> Self
fn from(input: StandardJsonCompilerInput) -> Self
Auto Trait Implementations§
impl Freeze for CompilerInput
impl RefUnwindSafe for CompilerInput
impl Send for CompilerInput
impl Sync for CompilerInput
impl Unpin for CompilerInput
impl UnwindSafe for CompilerInput
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
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>
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>
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 more