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));