alloy_sol_types

Enum RevertReason

Source
pub enum RevertReason<T> {
    ContractError(ContractError<T>),
    RawString(String),
}
Expand description

Represents the reason for a revert in a smart contract.

This enum captures two possible scenarios for a revert:

  • ContractError: Contains detailed error information, such as a specific Revert or Panic error.

  • RawString: Represents a raw string message as the reason for the revert.

Variants§

§

ContractError(ContractError<T>)

A detailed contract error, including a specific revert or panic error.

§

RawString(String)

Represents a raw string message as the reason for the revert.

Implementations§

Source§

impl<T: SolInterface> RevertReason<T>

Source

pub fn decode(out: &[u8]) -> Option<Self>

Decodes and retrieves the reason for a revert from the provided output data.

This method attempts to decode the provided output data as a generic contract error or a UTF-8 string (for Vyper reverts).

If successful, it returns the decoded revert reason wrapped in an Option.

If both attempts fail, it returns None.

Source§

impl<T: SolInterface + Display> RevertReason<T>

Source

pub fn to_string(&self) -> String

Returns the reason for a revert as a string.

Trait Implementations§

Source§

impl<T: Clone> Clone for RevertReason<T>

Source§

fn clone(&self) -> RevertReason<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for RevertReason<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Display> Display for RevertReason<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> From<ContractError<T>> for RevertReason<T>

Converts a ContractError<T> into a RevertReason<T>.

Source§

fn from(error: ContractError<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Revert> for RevertReason<T>

Converts a Revert into a RevertReason<T>.

Source§

fn from(revert: Revert) -> Self

Converts to this type from the input type.
Source§

impl<T> From<String> for RevertReason<T>

Converts a String into a RevertReason<T>.

Source§

fn from(raw_string: String) -> Self

Converts to this type from the input type.
Source§

impl<T: PartialEq> PartialEq for RevertReason<T>

Source§

fn eq(&self, other: &RevertReason<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Eq> Eq for RevertReason<T>

Source§

impl<T> StructuralPartialEq for RevertReason<T>

Auto Trait Implementations§

§

impl<T> Freeze for RevertReason<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for RevertReason<T>
where T: RefUnwindSafe,

§

impl<T> Send for RevertReason<T>
where T: Send,

§

impl<T> Sync for RevertReason<T>
where T: Sync,

§

impl<T> Unpin for RevertReason<T>
where T: Unpin,

§

impl<T> UnwindSafe for RevertReason<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V