#[non_exhaustive]
pub enum RevertReason { Custom(String), ReadOutOfBounds { what: String, }, UnknownSelector, ValueIsTooLarge { what: String, }, PointerToOutofBound, CursorOverflow, ExpectedAtLeastNArguments(usize), }
Expand description

Possible revert reasons.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Custom(String)

A custom revert reason if other variants are not appropriate.

§

ReadOutOfBounds

Fields

§what: String

What was being read?

Tried to read data out of bounds.

§

UnknownSelector

An unknown selector has been provided.

§

ValueIsTooLarge

Fields

§what: String

What was being read?

A value is too large to fit in the wanted type. For security reasons integers are always parsed as uint256 then casted to the wanted type. If the value overflows this type then this revert is used.

§

PointerToOutofBound

A pointer (used for structs and arrays) points out of bounds.

§

CursorOverflow

The reading cursor overflowed. This should realistically never happen as it would require an input of length larger than 2^64, which would cost too much to be included in a block.

§

ExpectedAtLeastNArguments(usize)

Used by a check that the input contains at least N static arguments. Often use to return early if the input is too short.

Implementations§

source§

impl RevertReason

source

pub fn custom(s: impl Into<String>) -> Self

Create a RevertReason::Custom from anything that can be converted to a String. Argument is the custom revert message.

source

pub fn read_out_of_bounds(what: impl Into<String>) -> Self

Create a RevertReason::ReadOutOfBounds from anything that can be converted to a String. Argument names what was expected to be read.

source

pub fn value_is_too_large(what: impl Into<String>) -> Self

Create a RevertReason::ValueIsTooLarge from anything that can be converted to a String. Argument names what was expected to be read.

Trait Implementations§

source§

impl Display for RevertReason

source§

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

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

impl From<RevertReason> for PrecompileFailure

source§

fn from(err: RevertReason) -> Self

Converts to this type from the input type.
source§

impl From<RevertReason> for Revert

source§

fn from(a: RevertReason) -> Revert

Converts to this type from the input type.
source§

impl InjectBacktrace for RevertReason

§

type Output = Revert

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

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

Occurs in a field.
source§

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

Occurs in an array at provided index.
source§

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

Occurs in a tuple.
source§

impl PartialEq for RevertReason

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for RevertReason

source§

impl StructuralEq for RevertReason

source§

impl StructuralPartialEq for RevertReason

Auto Trait Implementations§

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
§

impl<T> CheckedConversion for T

§

fn checked_from<T>(t: T) -> Option<Self>
where Self: TryFrom<T>,

Convert from a value of T into an equivalent instance of Option<Self>. Read more
§

fn checked_into<T>(self) -> Option<T>
where Self: TryInto<T>,

Consume self to return Some equivalent value of Option<T>. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T, U> IntoKey<U> for T
where U: FromKey<T>,

§

fn into_key(self) -> U

§

impl<T> IsType<T> for T

§

fn from_ref(t: &T) -> &T

Cast reference.
§

fn into_ref(&self) -> &T

Cast reference.
§

fn from_mut(t: &mut T) -> &mut T

Cast mutable reference.
§

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

Cast mutable reference.
§

impl<T, Outer> IsWrappedBy<Outer> for T
where Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,

§

fn from_ref(outer: &Outer) -> &T

Get a reference to the inner from the outer.

§

fn from_mut(outer: &mut Outer) -> &mut T

Get a mutable reference to the inner from the outer.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<T> SaturatedConversion for T

§

fn saturated_from<T>(t: T) -> Self
where Self: UniqueSaturatedFrom<T>,

Convert from a value of T into an equivalent instance of Self. Read more
§

fn saturated_into<T>(self) -> T
where Self: UniqueSaturatedInto<T>,

Consume self to return an equivalent value of T. 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>,

§

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>,

§

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.
§

impl<T, U> TryIntoKey<U> for T
where 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 S
where T: UncheckedFrom<S>,

§

fn unchecked_into(self) -> T

The counterpart to unchecked_from.
§

impl<T, S> UniqueSaturatedInto<T> for S
where T: Bounded, S: TryInto<T>,

§

fn unique_saturated_into(self) -> T

Consume self to return an equivalent value of T.
§

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

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> JsonSchemaMaybe for T

§

impl<T> MaybeDisplay for T
where T: Display,

§

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