pub type MayRevert<T = ()> = Result<T, Revert>;
Expand description

Represent the result of a computation that can revert.

Aliased Type§

enum MayRevert<T = ()> {
    Ok(T),
    Err(Revert),
}

Variants§

§1.0.0

Ok(T)

Contains the success value

§1.0.0

Err(Revert)

Contains the error value

Trait Implementations§

source§

impl<T> BacktraceExt for MayRevert<T>

source§

fn map_in_tuple_to_field(self, fields: &[&'static str]) -> Self

Map last tuple entry into a field. Does nothing if last entry is not a tuple. As in Solidity structs are equivalent to tuples and are tricky to parse correctly, it allows to parse any struct as a tuple (with the correct implementation in this crate) and then map tuple indices to struct fields.
source§

impl<T> InjectBacktrace for MayRevert<T>

§

type Output = Result<T, Revert>

Output type of the injection. Should be a type that can hold a backtrace.
source§

fn in_field(self, field: impl Into<String>) -> Self

Occurs in a field.
source§

fn in_array(self, index: usize) -> Self

Occurs in an array at provided index.
source§

fn in_tuple(self, index: usize) -> Self

Occurs in a tuple.
source§

impl<T> RevertExt for MayRevert<T>

source§

fn map_reason(self, f: impl FnOnce(RevertReason) -> RevertReason) -> Self

Map the reason while keeping the same backtrace.