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.
Trait Implementations§
Source§impl<'de, 'a> Deserialize<'de> for AbiItem<'a>
impl<'de, 'a> Deserialize<'de> for AbiItem<'a>
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>,
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
Source§impl From<Constructor> for AbiItem<'_>
impl From<Constructor> for AbiItem<'_>
Source§fn from(item: Constructor) -> Self
fn from(item: Constructor) -> Self
Source§impl<'a> FromIterator<AbiItem<'a>> for JsonAbi
impl<'a> FromIterator<AbiItem<'a>> for JsonAbi
impl<'a> Eq for AbiItem<'a>
impl<'a> StructuralPartialEq for AbiItem<'a>
Auto Trait Implementations§
impl<'a> Freeze for AbiItem<'a>
impl<'a> RefUnwindSafe for AbiItem<'a>
impl<'a> Send for AbiItem<'a>
impl<'a> Sync for AbiItem<'a>
impl<'a> Unpin for AbiItem<'a>
impl<'a> UnwindSafe for AbiItem<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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: 40 bytes
Size for each variant:
Constructor: 20 bytesFallback: 12 bytesReceive: 12 bytesFunction: 40 bytesEvent: 32 bytesError: 28 bytes