pub struct Constructor {
pub inputs: Vec<Param>,
pub state_mutability: StateMutability,
}Available on crate feature
json-abi only.Expand description
A JSON ABI constructor function.
Fields§
§inputs: Vec<Param>The input types of the constructor. May be empty.
state_mutability: StateMutabilityThe state mutability of the constructor.
Implementations§
Source§impl Constructor
impl Constructor
Sourcepub fn parse(s: &str) -> Result<Constructor, Error>
pub fn parse(s: &str) -> Result<Constructor, Error>
Parses a Solidity constructor string:
constructor($($inputs),*) [visibility] [s_mutability]
Note:
- the name must always be
constructor - visibility is ignored
§Examples
assert_eq!(
Constructor::parse("constructor(uint foo, address bar)"),
Ok(Constructor {
inputs: vec![Param::parse("uint foo").unwrap(), Param::parse("address bar").unwrap()],
state_mutability: StateMutability::NonPayable,
}),
);Trait Implementations§
Source§impl Clone for Constructor
impl Clone for Constructor
Source§fn clone(&self) -> Constructor
fn clone(&self) -> Constructor
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Constructor
impl Debug for Constructor
Source§impl<'de> Deserialize<'de> for Constructor
impl<'de> Deserialize<'de> for Constructor
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Constructor, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Constructor, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a> From<&'a Constructor> for AbiItem<'a>
impl<'a> From<&'a Constructor> for AbiItem<'a>
Source§fn from(item: &'a Constructor) -> AbiItem<'a>
fn from(item: &'a Constructor) -> AbiItem<'a>
Converts to this type from the input type.
Source§impl From<Constructor> for AbiItem<'_>
impl From<Constructor> for AbiItem<'_>
Source§fn from(item: Constructor) -> AbiItem<'_>
fn from(item: Constructor) -> AbiItem<'_>
Converts to this type from the input type.
Source§impl FromStr for Constructor
impl FromStr for Constructor
Source§impl Hash for Constructor
impl Hash for Constructor
Source§impl JsonAbiExt for Constructor
impl JsonAbiExt for Constructor
Source§fn abi_encode_input(&self, values: &[DynSolValue]) -> Result<Vec<u8>, Error>
fn abi_encode_input(&self, values: &[DynSolValue]) -> Result<Vec<u8>, Error>
ABI-encodes the given values, prefixed by this item’s selector, if any. Read more
Source§fn abi_encode_input_raw(&self, values: &[DynSolValue]) -> Result<Vec<u8>, Error>
fn abi_encode_input_raw(&self, values: &[DynSolValue]) -> Result<Vec<u8>, Error>
ABI-encodes the given values, without prefixing the data with the item’s
selector. Read more
Source§fn abi_decode_input(
&self,
data: &[u8],
validate: bool,
) -> Result<Vec<DynSolValue>, Error>
fn abi_decode_input( &self, data: &[u8], validate: bool, ) -> Result<Vec<DynSolValue>, Error>
ABI-decodes the given data according to this item’s input types. Read more
Source§impl PartialEq for Constructor
impl PartialEq for Constructor
Source§impl Serialize for Constructor
impl Serialize for Constructor
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for Constructor
impl StructuralPartialEq for Constructor
Auto Trait Implementations§
impl Freeze for Constructor
impl RefUnwindSafe for Constructor
impl Send for Constructor
impl Sync for Constructor
impl Unpin for Constructor
impl UnwindSafe for Constructor
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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> ⓘ
Converts
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> ⓘ
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 32 bytes