alloy_dyn_abi

Trait Specifier

Source
pub trait Specifier<T> {
    // Required method
    fn resolve(&self) -> Result<T>;
}
Expand description

Trait for items that can be resolved to DynSol*, i.e. they specify some Solidity interface item.

The Specifier trait is implemented by types that can be resolved into Solidity interface items, e.g. DynSolType or DynSolEvent.

ABI and related systems have many different ways of specifying Solidity interfaces. This trait provides a single pattern for resolving those encodings into Solidity interface items.

Specifier<DynSolType> is implemented for all the parser types, the Param and EventParam structs, and str. The str implementation calls DynSolType::parse.

§Examples

let my_ty = TypeSpecifier::parse("bool")?.resolve()?;
assert_eq!(my_ty, DynSolType::Bool);

let my_ty = RootType::parse("uint256")?.resolve()?;
assert_eq!(my_ty, DynSolType::Uint(256));

assert_eq!("bytes32".resolve()?, DynSolType::FixedBytes(32));

Required Methods§

Source

fn resolve(&self) -> Result<T>

Resolve the type into a value.

Implementations on Foreign Types§

Source§

impl Specifier<DynSolType> for TypeStem<'_>

Source§

impl Specifier<DynSolType> for str

Source§

impl Specifier<DynSolType> for String

Source§

impl Specifier<DynSolType> for EventParam

Source§

impl Specifier<DynSolType> for Param

Source§

impl Specifier<DynSolType> for ParameterSpecifier<'_>

Source§

impl Specifier<DynSolType> for Parameters<'_>

Source§

impl Specifier<DynSolType> for RootType<'_>

Source§

impl Specifier<DynSolType> for TupleSpecifier<'_>

Source§

impl Specifier<DynSolType> for TypeSpecifier<'_>

Source§

impl Specifier<DynSolCall> for Function

Source§

impl Specifier<DynSolError> for Error

Source§

impl Specifier<DynSolEvent> for Event

Source§

impl<T: ?Sized + ToOwned + Specifier<DynSolType>> Specifier<DynSolType> for Cow<'_, T>

Source§

impl<T: ?Sized + Specifier<DynSolType>> Specifier<DynSolType> for &T

Source§

impl<T: ?Sized + Specifier<DynSolType>> Specifier<DynSolType> for &mut T

Source§

impl<T: ?Sized + Specifier<DynSolType>> Specifier<DynSolType> for Box<T>

Source§

impl<T: ?Sized + Specifier<DynSolType>> Specifier<DynSolType> for Rc<T>

Source§

impl<T: ?Sized + Specifier<DynSolType>> Specifier<DynSolType> for Arc<T>

Implementors§