pub struct Resolver { /* private fields */ }dyn-abi only.Expand description
A dependency graph built from the Eip712Types object. This is used to
safely resolve JSON into a crate::DynSolType by detecting cycles in the
type graph and traversing the dep graph.
Implementations§
Source§impl Resolver
impl Resolver
Sourcepub fn from_struct<S>() -> Resolverwhere
S: SolStruct,
Available on crate feature eip712 only.
pub fn from_struct<S>() -> Resolverwhere
S: SolStruct,
eip712 only.Instantiate a new resolver from a SolStruct type.
Sourcepub fn ingest_string(&mut self, s: impl AsRef<str>) -> Result<(), Error>
Available on crate feature eip712 only.
pub fn ingest_string(&mut self, s: impl AsRef<str>) -> Result<(), Error>
eip712 only.Ingest types from an EIP-712 encodeType.
Sourcepub fn ingest_sol_struct<S>(&mut self)where
S: SolStruct,
Available on crate feature eip712 only.
pub fn ingest_sol_struct<S>(&mut self)where
S: SolStruct,
eip712 only.Ingest a sol struct typedef.
Sourcepub fn ingest(&mut self, type_def: TypeDef)
Available on crate feature eip712 only.
pub fn ingest(&mut self, type_def: TypeDef)
eip712 only.Ingest a type.
Sourcepub fn ingest_types(&mut self, types: &Eip712Types)
Available on crate feature eip712 only.
pub fn ingest_types(&mut self, types: &Eip712Types)
eip712 only.Ingest a Types object into the resolver, discarding any invalid types.
Sourcepub fn linearize(&self, type_name: &str) -> Result<Vec<&TypeDef>, Error>
Available on crate feature eip712 only.
pub fn linearize(&self, type_name: &str) -> Result<Vec<&TypeDef>, Error>
eip712 only.This function linearizes a type into a list of typedefs of its dependencies.
Sourcepub fn resolve(&self, type_name: &str) -> Result<DynSolType, Error>
Available on crate feature eip712 only.
pub fn resolve(&self, type_name: &str) -> Result<DynSolType, Error>
eip712 only.Resolve a typename into a crate::DynSolType or return an error if
the type is missing, or contains a circular dependency.
Sourcepub fn encode_type(&self, name: &str) -> Result<String, Error>
Available on crate feature eip712 only.
pub fn encode_type(&self, name: &str) -> Result<String, Error>
eip712 only.Encode the type into an EIP-712 encodeType string
https://eips.ethereum.org/EIPS/eip-712#definition-of-encodetype
Sourcepub fn type_hash(&self, name: &str) -> Result<FixedBytes<32>, Error>
Available on crate feature eip712 only.
pub fn type_hash(&self, name: &str) -> Result<FixedBytes<32>, Error>
eip712 only.Compute the keccak256 hash of the EIP-712 encodeType string.
Sourcepub fn encode_data(&self, value: &DynSolValue) -> Result<Option<Vec<u8>>, Error>
Available on crate feature eip712 only.
pub fn encode_data(&self, value: &DynSolValue) -> Result<Option<Vec<u8>>, Error>
eip712 only.Encode the data according to EIP-712 encodeData rules.
Sourcepub fn eip712_data_word(
&self,
value: &DynSolValue,
) -> Result<FixedBytes<32>, Error>
Available on crate feature eip712 only.
pub fn eip712_data_word( &self, value: &DynSolValue, ) -> Result<FixedBytes<32>, Error>
eip712 only.Encode the data as a struct property according to EIP-712 encodeData
rules. Atomic types are encoded as-is, while non-atomic types are
encoded as their encodeData hash.
Sourcepub fn contains_type_name(&self, name: &str) -> bool
Available on crate feature eip712 only.
pub fn contains_type_name(&self, name: &str) -> bool
eip712 only.Check if the resolver graph contains a type by its name.
§Warning
This checks by NAME only. It does NOT check for type
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Resolver
impl<'de> Deserialize<'de> for Resolver
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Resolver, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Resolver, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl From<&Eip712Types> for Resolver
impl From<&Eip712Types> for Resolver
Source§fn from(types: &Eip712Types) -> Resolver
fn from(types: &Eip712Types) -> Resolver
Source§impl From<&Resolver> for Eip712Types
impl From<&Resolver> for Eip712Types
Source§fn from(resolver: &Resolver) -> Eip712Types
fn from(resolver: &Resolver) -> Eip712Types
Source§impl From<Eip712Types> for Resolver
impl From<Eip712Types> for Resolver
Source§fn from(types: Eip712Types) -> Resolver
fn from(types: Eip712Types) -> Resolver
Source§impl Serialize for Resolver
impl Serialize for Resolver
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl Eq for Resolver
impl StructuralPartialEq for Resolver
Auto Trait Implementations§
impl Freeze for Resolver
impl RefUnwindSafe for Resolver
impl Send for Resolver
impl Sync for Resolver
impl Unpin for Resolver
impl UnwindSafe for Resolver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 48 bytes