Enum Result

Source
pub enum Result<T> {
    Ok(T),
    Err(Error),
}
Expand description

Result is a type that represents either success (Ok) or failure (Err). This is simple version of Result type to comply XRPL Hooks Webassembly restrictions

Variants§

§

Ok(T)

Contains the success value

§

Err(Error)

Contains the error value

Implementations§

Source§

impl<T> Result<T>

Source

pub fn expect(self, msg: &[u8]) -> T

Returns the contained Ok value, consuming the self value.

§Rollbacks

Rollbacks if the value is an Err, with a rollback message and error code.

Source

pub fn unwrap(self) -> T

Returns the contained Ok value, consuming the self value.

Because this function may rollback, its use is generally discouraged. Instead, prefer to use pattern matching and handle the Err case explicitly.

§Rollbacks

Rollbacks if the value is an Err, with a “error” and error code provided by the Err’s value.

Source

pub unsafe fn unwrap_unchecked(self) -> T

Returns the contained Ok value, consuming the self value, without checking that the value is not an Err.

§Safety

Calling this method on an Err is undefined behavior.

Source

pub const fn is_ok(&self) -> bool

Returns true if the result is Ok.

Source

pub const fn is_err(&self) -> bool

Returns true if the result is Err.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<T> UnwindSafe for Result<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> 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, 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.