pub struct Error {
pub name: String,
pub inputs: Vec<Param>,
}Available on crate feature
json-abi only.Expand description
A JSON ABI error.
Fields§
§name: StringThe name of the error.
inputs: Vec<Param>A list of the error’s components, in order.
Implementations§
Source§impl Error
impl Error
Sourcepub fn parse(s: &str) -> Result<Error, Error>
pub fn parse(s: &str) -> Result<Error, Error>
Parses a Solidity error signature string: $(error)? $name($($inputs),*)
If you want to parse a generic Human-Readable ABI string, use AbiItem::parse.
§Examples
Basic usage:
assert_eq!(
Error::parse("foo(bool bar)"),
Ok(Error { name: "foo".to_string(), inputs: vec![Param::parse("bool bar").unwrap()] }),
);Sourcepub fn signature(&self) -> String
pub fn signature(&self) -> String
Computes this error’s signature: $name($($inputs),*).
This is the preimage input used to compute the selector.
Sourcepub fn selector(&self) -> FixedBytes<4>
pub fn selector(&self) -> FixedBytes<4>
Computes this error’s selector: keccak256(self.signature())[..4]
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Error
impl<'de> Deserialize<'de> for Error
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Error, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Error, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl ErrorExt for Error
impl ErrorExt for Error
Source§fn decode_error(&self, data: &[u8]) -> Result<DecodedError, Error>
fn decode_error(&self, data: &[u8]) -> Result<DecodedError, Error>
Decode the error from the given data.
Source§impl JsonAbiExt for Error
impl JsonAbiExt for Error
Source§fn abi_encode_input(&self, values: &[DynSolValue]) -> Result<Vec<u8>, Error>
fn abi_encode_input(&self, values: &[DynSolValue]) -> Result<Vec<u8>, Error>
ABI-encodes the given values, prefixed by this item’s selector, if any. Read more
Source§fn abi_encode_input_raw(&self, values: &[DynSolValue]) -> Result<Vec<u8>, Error>
fn abi_encode_input_raw(&self, values: &[DynSolValue]) -> Result<Vec<u8>, Error>
ABI-encodes the given values, without prefixing the data with the item’s
selector. Read more
Source§fn abi_decode_input(
&self,
data: &[u8],
validate: bool,
) -> Result<Vec<DynSolValue>, Error>
fn abi_decode_input( &self, data: &[u8], validate: bool, ) -> Result<Vec<DynSolValue>, Error>
ABI-decodes the given data according to this item’s input types. Read more
Source§impl Serialize for Error
impl Serialize for Error
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,
Serialize this value into the given Serde serializer. Read more
Source§impl Specifier<DynSolError> for Error
impl Specifier<DynSolError> for Error
impl Eq for Error
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
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
Mutably borrows from an owned value. Read more
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
Compare self to
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> ⓘ
Converts
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> ⓘ
Converts
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