pub struct Constructor {
pub inputs: Vec<Param>,
pub state_mutability: StateMutability,
}
Expand description
A JSON ABI constructor function.
Fields§
§inputs: Vec<Param>
The input types of the constructor. May be empty.
state_mutability: StateMutability
The state mutability of the constructor.
Implementations§
Source§impl Constructor
impl Constructor
Sourcepub fn parse(s: &str) -> Result<Self>
pub fn parse(s: &str) -> Result<Self>
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<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
Source§impl<'a> From<&'a Constructor> for AbiItem<'a>
impl<'a> From<&'a Constructor> for AbiItem<'a>
Source§fn from(item: &'a Constructor) -> Self
fn from(item: &'a Constructor) -> Self
Converts to this type from the input type.
Source§impl From<Constructor> for AbiItem<'_>
impl From<Constructor> for AbiItem<'_>
Source§fn from(item: Constructor) -> Self
fn from(item: Constructor) -> Self
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 PartialEq for Constructor
impl PartialEq for Constructor
Source§impl Serialize for Constructor
impl Serialize for Constructor
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)