Struct ethers_solc::artifacts::contract::CompactContract
source · pub struct CompactContract {
pub abi: Option<Abi>,
pub bin: Option<BytecodeObject>,
pub bin_runtime: Option<BytecodeObject>,
}Expand description
The general purpose minimal representation of a contract’s abi with bytecode
Unlike CompactContractSome all fields are optional so that every possible compiler output can
be represented by it
Fields
abi: Option<Abi>The Ethereum Contract ABI. If empty, it is represented as an empty array. See https://docs.soliditylang.org/en/develop/abi-spec.html
bin: Option<BytecodeObject>bin_runtime: Option<BytecodeObject>Implementations
sourceimpl CompactContract
impl CompactContract
sourcepub fn into_parts(self) -> (Option<Abi>, Option<Bytes>, Option<Bytes>)
pub fn into_parts(self) -> (Option<Abi>, Option<Bytes>, Option<Bytes>)
Returns the contents of this type as a single tuple of abi, bytecode and deployed bytecode
sourcepub fn into_parts_or_default(self) -> (Abi, Bytes, Bytes)
pub fn into_parts_or_default(self) -> (Abi, Bytes, Bytes)
Returns the individual parts of this contract.
If the values are None, then Default is returned.
sourcepub fn unwrap(self) -> CompactContractSome
pub fn unwrap(self) -> CompactContractSome
Returns the CompactContractSome if all fields are Some
Panics
Panics if any of the fields euqal None
Example
use ethers_solc::Project;
use ethers_solc::artifacts::*;
let mut output = project.compile().unwrap().output();
let contract: CompactContract = output.remove_first("Greeter").unwrap().into();
let contract = contract.unwrap();sourcepub fn unwrap_or_default(self) -> CompactContractSome
pub fn unwrap_or_default(self) -> CompactContractSome
Returns the CompactContractSome if any if the field equals None the Default value is
returned
Unlike unwrap, this function does not panic
Trait Implementations
sourceimpl Clone for CompactContract
impl Clone for CompactContract
sourcefn clone(&self) -> CompactContract
fn clone(&self) -> CompactContract
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 moresourceimpl Debug for CompactContract
impl Debug for CompactContract
sourceimpl Default for CompactContract
impl Default for CompactContract
sourcefn default() -> CompactContract
fn default() -> CompactContract
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for CompactContract
impl<'de> Deserialize<'de> for CompactContract
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 From<CompactContractBytecode> for CompactContract
impl From<CompactContractBytecode> for CompactContract
sourcefn from(c: CompactContractBytecode) -> Self
fn from(c: CompactContractBytecode) -> Self
Converts to this type from the input type.
sourceimpl<'a> From<CompactContractRef<'a>> for CompactContract
impl<'a> From<CompactContractRef<'a>> for CompactContract
sourcefn from(c: CompactContractRef<'a>) -> Self
fn from(c: CompactContractRef<'a>) -> Self
Converts to this type from the input type.
sourceimpl<'a> From<CompactContractRefSome<'a>> for CompactContract
impl<'a> From<CompactContractRefSome<'a>> for CompactContract
sourcefn from(c: CompactContractRefSome<'a>) -> Self
fn from(c: CompactContractRefSome<'a>) -> Self
Converts to this type from the input type.
sourceimpl From<CompactContractSome> for CompactContract
impl From<CompactContractSome> for CompactContract
sourcefn from(c: CompactContractSome) -> Self
fn from(c: CompactContractSome) -> Self
Converts to this type from the input type.
sourceimpl From<ConfigurableContractArtifact> for CompactContract
impl From<ConfigurableContractArtifact> for CompactContract
sourcefn from(artifact: ConfigurableContractArtifact) -> Self
fn from(artifact: ConfigurableContractArtifact) -> Self
Converts to this type from the input type.
sourceimpl From<Contract> for CompactContract
impl From<Contract> for CompactContract
sourceimpl From<ContractBytecode> for CompactContract
impl From<ContractBytecode> for CompactContract
sourcefn from(c: ContractBytecode) -> Self
fn from(c: ContractBytecode) -> Self
Converts to this type from the input type.
sourceimpl From<ContractBytecodeSome> for CompactContract
impl From<ContractBytecodeSome> for CompactContract
sourcefn from(c: ContractBytecodeSome) -> Self
fn from(c: ContractBytecodeSome) -> Self
Converts to this type from the input type.
sourceimpl From<HardhatArtifact> for CompactContract
impl From<HardhatArtifact> for CompactContract
sourcefn from(artifact: HardhatArtifact) -> Self
fn from(artifact: HardhatArtifact) -> Self
Converts to this type from the input type.
sourceimpl From<Value> for CompactContract
impl From<Value> for CompactContract
sourceimpl PartialEq<CompactContract> for CompactContract
impl PartialEq<CompactContract> for CompactContract
sourcefn eq(&self, other: &CompactContract) -> bool
fn eq(&self, other: &CompactContract) -> bool
sourceimpl Serialize for CompactContract
impl Serialize for CompactContract
sourceimpl TryFrom<CompactContract> for CompactContractSome
impl TryFrom<CompactContract> for CompactContractSome
type Error = CompactContract
type Error = CompactContract
The type returned in the event of a conversion error.
sourcefn try_from(value: CompactContract) -> Result<Self, Self::Error>
fn try_from(value: CompactContract) -> Result<Self, Self::Error>
Performs the conversion.
impl StructuralPartialEq for CompactContract
Auto Trait Implementations
impl RefUnwindSafe for CompactContract
impl Send for CompactContract
impl Sync for CompactContract
impl Unpin for CompactContract
impl UnwindSafe for CompactContract
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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