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 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>,