Trait alloy_dyn_abi::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<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§