Struct ethers_solc::contracts::VersionedContracts
source · [−]pub struct VersionedContracts(pub FileToContractsMap<Vec<VersionedContract>>);Expand description
file -> [(contract name -> Contract + solc version)]
Tuple Fields
0: FileToContractsMap<Vec<VersionedContract>>Implementations
sourceimpl VersionedContracts
impl VersionedContracts
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
sourcepub fn find(&self, contract: impl AsRef<str>) -> Option<CompactContractRef<'_>>
pub fn find(&self, contract: impl AsRef<str>) -> Option<CompactContractRef<'_>>
Finds the first contract with the given name
Example
use ethers_solc::Project;
use ethers_solc::artifacts::*;
let output = project.compile().unwrap().output();
let contract = output.find("Greeter").unwrap();sourcepub fn remove(&mut self, contract: impl AsRef<str>) -> Option<Contract>
pub fn remove(&mut self, contract: impl AsRef<str>) -> Option<Contract>
Removes the first contract with the given name from the set
Example
use ethers_solc::Project;
use ethers_solc::artifacts::*;
let (_, mut contracts) = project.compile().unwrap().output().split();
let contract = contracts.remove("Greeter").unwrap();sourcepub fn get(&self, path: &str, contract: &str) -> Option<CompactContractRef<'_>>
pub fn get(&self, path: &str, contract: &str) -> Option<CompactContractRef<'_>>
Given the contract file’s path and the contract’s name, tries to return the contract’s bytecode, runtime bytecode, and abi
sourcepub fn contracts(&self) -> impl Iterator<Item = (&String, &Contract)>
pub fn contracts(&self) -> impl Iterator<Item = (&String, &Contract)>
Iterate over all contracts and their names
sourcepub fn contracts_with_files(
&self
) -> impl Iterator<Item = (&String, &String, &Contract)>
pub fn contracts_with_files(
&self
) -> impl Iterator<Item = (&String, &String, &Contract)>
Returns an iterator over (file, name, Contract)
sourcepub fn contracts_with_files_and_version(
&self
) -> impl Iterator<Item = (&String, &String, &Contract, &Version)>
pub fn contracts_with_files_and_version(
&self
) -> impl Iterator<Item = (&String, &String, &Contract, &Version)>
Returns an iterator over (file, name, Contract, Version)
sourcepub fn into_contracts(self) -> impl Iterator<Item = (String, Contract)>
pub fn into_contracts(self) -> impl Iterator<Item = (String, Contract)>
Returns an iterator over all contracts and their source names.
use std::collections::BTreeMap;
use ethers_solc::{ artifacts::*, Artifact };
use ethers_solc::artifacts::contract::CompactContractSome;
let contracts: BTreeMap<String, CompactContractSome> = contracts
.into_contracts()
.map(|(k, c)| (k, c.into_compact_contract().unwrap()))
.collect();sourcepub fn join_all(&mut self, root: impl AsRef<Path>) -> &mut Self
pub fn join_all(&mut self, root: impl AsRef<Path>) -> &mut Self
Sets the contract’s file paths to root adjoined to self.file.
sourcepub fn strip_prefix_all(&mut self, base: impl AsRef<Path>) -> &mut Self
pub fn strip_prefix_all(&mut self, base: impl AsRef<Path>) -> &mut Self
Removes base from all contract paths
Trait Implementations
sourceimpl AsMut<BTreeMap<String, BTreeMap<String, Vec<VersionedContract, Global>>>> for VersionedContracts
impl AsMut<BTreeMap<String, BTreeMap<String, Vec<VersionedContract, Global>>>> for VersionedContracts
sourcefn as_mut(&mut self) -> &mut FileToContractsMap<Vec<VersionedContract>>
fn as_mut(&mut self) -> &mut FileToContractsMap<Vec<VersionedContract>>
Converts this type into a mutable reference of the (usually inferred) input type.
sourceimpl AsRef<BTreeMap<String, BTreeMap<String, Vec<VersionedContract, Global>>>> for VersionedContracts
impl AsRef<BTreeMap<String, BTreeMap<String, Vec<VersionedContract, Global>>>> for VersionedContracts
sourcefn as_ref(&self) -> &FileToContractsMap<Vec<VersionedContract>>
fn as_ref(&self) -> &FileToContractsMap<Vec<VersionedContract>>
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl Clone for VersionedContracts
impl Clone for VersionedContracts
sourcefn clone(&self) -> VersionedContracts
fn clone(&self) -> VersionedContracts
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for VersionedContracts
impl Debug for VersionedContracts
sourceimpl Default for VersionedContracts
impl Default for VersionedContracts
sourcefn default() -> VersionedContracts
fn default() -> VersionedContracts
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for VersionedContracts
impl<'de> Deserialize<'de> for VersionedContracts
sourcefn 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
sourceimpl IntoIterator for VersionedContracts
impl IntoIterator for VersionedContracts
sourceimpl PartialEq<VersionedContracts> for VersionedContracts
impl PartialEq<VersionedContracts> for VersionedContracts
sourcefn eq(&self, other: &VersionedContracts) -> bool
fn eq(&self, other: &VersionedContracts) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &VersionedContracts) -> bool
fn ne(&self, other: &VersionedContracts) -> bool
This method tests for !=.
sourceimpl Serialize for VersionedContracts
impl Serialize for VersionedContracts
impl StructuralPartialEq for VersionedContracts
Auto Trait Implementations
impl RefUnwindSafe for VersionedContracts
impl Send for VersionedContracts
impl Sync for VersionedContracts
impl Unpin for VersionedContracts
impl UnwindSafe for VersionedContracts
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more