alloy_json_abi

Enum AbiItem

Source
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<'_>

Source

pub const fn json_type(&self) -> &'static str

Returns the JSON type of the item as a string.

§Examples
let item = AbiItem::parse("function f()")?;
assert_eq!(item.json_type(), "function");
Source§

impl AbiItem<'_>

Source

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()),
);
Source

pub const fn debug_name(&self) -> &'static str

Returns the debug name of the item.

Source

pub fn name(&self) -> Option<&String>

Returns an immutable reference to the name of the item.

Source

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.

Source

pub fn state_mutability(&self) -> Option<StateMutability>

Returns the state mutability of the item.

Source

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.

Source

pub fn inputs(&self) -> Option<&Vec<Param>>

Returns an immutable reference to the inputs of the item.

Use event_inputs for events instead.

Source

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.

Source

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.

Source

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.

Source

pub fn outputs(&self) -> Option<&Vec<Param>>

Returns an immutable reference to the outputs of the item.

Source

pub fn outputs_mut(&mut self) -> Option<&mut Vec<Param>>

Returns an immutable reference to the outputs of the item.

Trait Implementations§

Source§

impl<'a> Clone for AbiItem<'a>

Source§

fn clone(&self) -> AbiItem<'a>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for AbiItem<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, 'a> Deserialize<'de> for AbiItem<'a>

Source§

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>

Source§

fn from(item: &'a Constructor) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Error> for AbiItem<'a>

Source§

fn from(item: &'a Error) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Event> for AbiItem<'a>

Source§

fn from(item: &'a Event) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Fallback> for AbiItem<'a>

Source§

fn from(item: &'a Fallback) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Function> for AbiItem<'a>

Source§

fn from(item: &'a Function) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Receive> for AbiItem<'a>

Source§

fn from(item: &'a Receive) -> Self

Converts to this type from the input type.
Source§

impl From<Constructor> for AbiItem<'_>

Source§

fn from(item: Constructor) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for AbiItem<'_>

Source§

fn from(item: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Event> for AbiItem<'_>

Source§

fn from(item: Event) -> Self

Converts to this type from the input type.
Source§

impl From<Fallback> for AbiItem<'_>

Source§

fn from(item: Fallback) -> Self

Converts to this type from the input type.
Source§

impl From<Function> for AbiItem<'_>

Source§

fn from(item: Function) -> Self

Converts to this type from the input type.
Source§

impl From<Receive> for AbiItem<'_>

Source§

fn from(item: Receive) -> Self

Converts to this type from the input type.
Source§

impl<'a> FromIterator<AbiItem<'a>> for JsonAbi

Source§

fn from_iter<T: IntoIterator<Item = AbiItem<'a>>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl FromStr for AbiItem<'_>

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<'a> Hash for AbiItem<'a>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a> PartialEq for AbiItem<'a>

Source§

fn eq(&self, other: &AbiItem<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for AbiItem<'_>

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> Eq for AbiItem<'a>

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,