Struct precompile_utils::solidity::revert::Revert
source · pub struct Revert { /* private fields */ }
Expand description
An revert returned by various functions in precompile-utils.
Allows to dynamically construct the backtrace (backtrace) of the revert
and manage it in a typed way.
Can be transformed into a PrecompileFailure::Revert
and String
, and
implement Display
and Debug
.
Implementations§
source§impl Revert
impl Revert
sourcepub fn new(reason: RevertReason) -> Self
pub fn new(reason: RevertReason) -> Self
Create a new Revert
with a RevertReason
and
an empty backtrace.
sourcepub fn change_what(self, what: impl Into<String>) -> Self
pub fn change_what(self, what: impl Into<String>) -> Self
For all RevertReason
variants that have a what
field, change its value.
Otherwise do nothing.
It is useful when writing custom types solidity::Codec
implementations using
simpler types.
sourcepub fn to_encoded_bytes(self) -> Vec<u8> ⓘ
pub fn to_encoded_bytes(self) -> Vec<u8> ⓘ
Transforms the revert into its bytes representation (from a String).
Trait Implementations§
source§impl BacktraceExt for Revert
impl BacktraceExt for Revert
source§fn map_in_tuple_to_field(self, fields: &[&'static str]) -> Self
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 From<RevertReason> for Revert
impl From<RevertReason> for Revert
source§fn from(a: RevertReason) -> Revert
fn from(a: RevertReason) -> Revert
Converts to this type from the input type.
source§impl InjectBacktrace for Revert
impl InjectBacktrace for Revert
source§impl PartialEq for Revert
impl PartialEq for Revert
source§impl RevertExt for Revert
impl RevertExt for Revert
source§fn map_reason(self, f: impl FnOnce(RevertReason) -> RevertReason) -> Self
fn map_reason(self, f: impl FnOnce(RevertReason) -> RevertReason) -> Self
Map the reason while keeping the same backtrace.
impl Eq for Revert
impl StructuralEq for Revert
impl StructuralPartialEq for Revert
Auto Trait Implementations§
impl RefUnwindSafe for Revert
impl Send for Revert
impl Sync for Revert
impl Unpin for Revert
impl UnwindSafe for Revert
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
§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
§fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
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.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IsType<T> for T
impl<T> IsType<T> for T
§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of
T
. Read more§impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
type Error = <U as TryFromKey<T>>::Error
fn try_into_key(self) -> Result<U, <U as TryFromKey<T>>::Error>
§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from
.§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T
.