Struct ethers::solc::Solc[][src]

pub struct Solc {
    pub solc: PathBuf,
    pub args: Vec<String, Global>,
}
Expand description

Abstraction over solc command line utility

Supports sync and async functions.

Fields

solc: PathBuf

Path to the solc executable

args: Vec<String, Global>

Additional arguments passed to the solc exectuable

Implementations

A new instance which points to solc

Adds an argument to pass to the solc command.

Adds multiple arguments to pass to the solc.

Returns the directory in which svm stores all versions

This will be ~/.svm on unix

Returns the path for a svm installed version.

Example
 use ethers_solc::Solc;
let solc = Solc::find_svm_installed_version("0.8.9").unwrap();
assert_eq!(solc, Some(Solc::new("~/.svm/0.8.9/solc-0.8.9")));

Assuming the versions array is sorted, it returns the first element which satisfies the provided VersionReq

Given a Solidity source, it detects the latest compiler version which can be used to build it, and returns it.

If the required compiler version is not installed, it also proceeds to install it.

Parses the given source looking for the pragma definition and returns the corresponding SemVer version requirement.

Installs the provided version of Solc in the machine under the svm dir

Example
 use ethers_solc::{Solc, ISTANBUL_SOLC};
 Solc::install(&ISTANBUL_SOLC).await.unwrap();
 let solc = Solc::find_svm_installed_version(&ISTANBUL_SOLC.to_string());

Blocking version of Self::install

Verify that the checksum for this version of solc is correct. We check against the SHA256 checksum from the build information published by binaries.soliditylang

Convenience function for compiling all sources under the given path

Run solc --stand-json and return the solc’s output as CompilerOutput

Example
 use ethers_solc::{CompilerInput, Solc};
let solc = Solc::default();
let input = CompilerInput::new("./contracts")?;
let output = solc.compile(&input)?;

Run solc --stand-json and return the solc’s output as the given json output

Returns the version from the configured solc

Convenience function for compiling all sources under the given path

Run solc --stand-json and return the solc’s output as CompilerOutput

Run solc --stand-json and return the solc’s output as the given json output

Trait Implementations

Performs the conversion.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Performs the conversion.

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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