pub enum AbiItem<'a> {
Constructor(Cow<'a, Constructor>),
Fallback(Cow<'a, Fallback>),
Receive(Cow<'a, Receive>),
Function(Cow<'a, Function>),
Event(Cow<'a, Event>),
Error(Cow<'a, Error>),
}Expand description
A JSON ABI item.
Variants§
Constructor(Cow<'a, Constructor>)
A JSON ABI Constructor.
Fallback(Cow<'a, Fallback>)
A JSON ABI Fallback.
Receive(Cow<'a, Receive>)
A JSON ABI Receive.
Function(Cow<'a, Function>)
A JSON ABI Function.
Event(Cow<'a, Event>)
A JSON ABI Event.
Error(Cow<'a, Error>)
A JSON ABI Error.
Implementations§
Source§impl AbiItem<'_>
impl AbiItem<'_>
Sourcepub fn parse(input: &str) -> Result<Self>
pub fn parse(input: &str) -> Result<Self>
Parses a single Human-Readable ABI string into an ABI item.
§Examples
assert_eq!(
AbiItem::parse("function foo(bool bar)"),
Ok(AbiItem::from(Function::parse("foo(bool bar)").unwrap()).into()),
);Sourcepub const fn debug_name(&self) -> &'static str
pub const fn debug_name(&self) -> &'static str
Returns the debug name of the item.
Sourcepub fn name_mut(&mut self) -> Option<&mut String>
pub fn name_mut(&mut self) -> Option<&mut String>
Returns a mutable reference to the name of the item.
Clones the item if it is not already owned.
Sourcepub fn state_mutability(&self) -> Option<StateMutability>
pub fn state_mutability(&self) -> Option<StateMutability>
Returns the state mutability of the item.
Sourcepub fn state_mutability_mut(&mut self) -> Option<&mut StateMutability>
pub fn state_mutability_mut(&mut self) -> Option<&mut StateMutability>
Returns a mutable reference to the state mutability of the item.
Clones the item if it is not already owned.
Sourcepub fn inputs(&self) -> Option<&Vec<Param>>
pub fn inputs(&self) -> Option<&Vec<Param>>
Returns an immutable reference to the inputs of the item.
Use event_inputs for events instead.
Sourcepub fn inputs_mut(&mut self) -> Option<&mut Vec<Param>>
pub fn inputs_mut(&mut self) -> Option<&mut Vec<Param>>
Returns a mutable reference to the inputs of the item.
Clones the item if it is not already owned.
Use event_inputs for events instead.
Sourcepub fn event_inputs(&self) -> Option<&Vec<EventParam>>
pub fn event_inputs(&self) -> Option<&Vec<EventParam>>
Returns an immutable reference to the event inputs of the item.
Use inputs for other items instead.
Sourcepub fn event_inputs_mut(&mut self) -> Option<&mut Vec<EventParam>>
pub fn event_inputs_mut(&mut self) -> Option<&mut Vec<EventParam>>
Returns a mutable reference to the event inputs of the item.
Clones the item if it is not already owned.
Use inputs for other items instead.
Sourcepub fn outputs(&self) -> Option<&Vec<Param>>
pub fn outputs(&self) -> Option<&Vec<Param>>
Returns an immutable reference to the outputs of the item.
Sourcepub fn outputs_mut(&mut self) -> Option<&mut Vec<Param>>
pub fn outputs_mut(&mut self) -> Option<&mut Vec<Param>>
Returns an immutable reference to the outputs of the item.