pub struct ProjectCompileOutput<T: ArtifactOutput = ConfigurableArtifacts> { /* private fields */ }
Expand description

Contains a mixture of already compiled/cached artifacts and the input set of sources that still need to be compiled.

Implementations

All artifacts together with their contract file name and name <file name>:<name>

This returns a chained iterator of both cached and recompiled contract artifacts

Example
use std::collections::btree_map::BTreeMap;
use ethers_solc::ConfigurableContractArtifact;
use ethers_solc::{ArtifactId, Project};

let project = Project::builder().build().unwrap();
let contracts: BTreeMap<ArtifactId, ConfigurableContractArtifact> = project.compile().unwrap().into_artifacts().collect();

All artifacts together with their contract file and name as tuple (file, contract name, artifact)

This returns a chained iterator of both cached and recompiled contract artifacts

Example
use std::collections::btree_map::BTreeMap;
use ethers_solc::{ConfigurableContractArtifact, Project};

let project = Project::builder().build().unwrap();
let contracts: Vec<(String, String, ConfigurableContractArtifact)> = project.compile().unwrap().into_artifacts_with_files().collect();

NOTE the file will be returned as is, see also Self::with_stripped_file_prefixes()

All artifacts together with their ID and the sources of the project.

Note: this only returns the SourceFiles for freshly compiled contracts because, if not included in the Artifact itself (see crate::ConfigurableContractArtifact::source_file()), is only available via the solc CompilerOutput

Strips the given prefix from all artifact file paths to make them relative to the given base argument

Example

Make all artifact files relative to the project’s root directory

use ethers_solc::Project;

let project = Project::builder().build().unwrap();
let output = project.compile().unwrap().with_stripped_file_prefixes(project.root());

Get the (merged) solc compiler output

use std::collections::btree_map::BTreeMap;
use ethers_solc::artifacts::contract::Contract;
use ethers_solc::Project;

let project = Project::builder().build().unwrap();
let contracts: BTreeMap<String, Contract> =
    project.compile().unwrap().output().contracts_into_iter().collect();

Whether this type has a compiler output

Whether this type does not contain compiled contracts

Whether there were errors

Whether there were warnings

Finds the first contract with the given name and removes it from the set

Returns the set of Artifacts that were cached and got reused during crate::Project::compile()

Returns the set of Artifacts that were compiled with solc in crate::Project::compile()

Returns a BTreeMap that maps the compiler version used during crate::Project::compile() to a Vector of tuples containing the contract name and the Contract

Finds the first contract with the given name

A helper functions that extracts the underlying CompactContractBytecode from the crate::ConfigurableContractArtifact

Example
use std::collections::btree_map::BTreeMap;
use ethers_solc::artifacts::contract::CompactContractBytecode;
use ethers_solc::{ArtifactId, Project};

let project = Project::builder().build().unwrap();
let contracts: BTreeMap<ArtifactId, CompactContractBytecode> = project.compile().unwrap().into_contract_bytecodes().collect();

Trait Implementations

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

Formats the value using the given formatter. 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

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

Returns the argument unchanged.

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

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The resulting type after obtaining ownership.

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

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

Converts the given value to a String. 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