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) that better conforms to the xrpld programmability APIs.

Variants§

§

Ok(T)

Contains the success value

§

Err(Error)

Contains the error value

Implementations§

Source§

impl<T> Result<T>

Source

pub fn is_ok(&self) -> bool

Returns true if the result is Ok.

Source

pub fn is_err(&self) -> bool

Returns true if the result is Err.

Source

pub fn ok(self) -> Option<T>

Converts from Result<T> to Option<T>.

Converts self into an Option<T>, consuming self, and discarding the error, if any.

Source

pub fn err(self) -> Option<Error>

Converts from Result<T> to Option<Error>.

Converts self into an Option<Error>, consuming self, and discarding the success value, if any.

Source

pub fn unwrap(self) -> T

Returns the contained Ok value, consuming the self value.

§Panics

Panics if the value is an Err, with a panic message provided by the Err’s value.

Source

pub fn unwrap_or(self, default: T) -> T

Returns the contained Ok value or a provided default.

Source

pub fn unwrap_or_else<F: FnOnce(Error) -> T>(self, op: F) -> T

Returns the contained Ok value or computes it from a closure.

Source

pub fn unwrap_or_panic(self) -> T

Trait Implementations§

Source§

impl From<i64> for Result<u64>

Source§

fn from(value: i64) -> Self

Converts to this type from the input type.

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.