Struct emf_core_base_rs_ffi::collections::Result[][src]

#[repr(C)]
#[must_use]
pub struct Result<T, E> where
    T: Copy + Sized,
    E: Copy + Sized
{ /* fields omitted */ }

A type that represents either a result or an error.

Implementations

impl<T, E> Result<T, E> where
    T: Copy + Sized,
    E: Copy + Sized
[src]

pub fn new_ok(value: T) -> Self[src]

Creates a new result containing a value.

pub fn new_err(err: E) -> Self[src]

Creates a new result containing an error.

pub fn is_ok(&self) -> bool[src]

Returns true if the result contains a value.

pub fn is_err(&self) -> bool[src]

Returns true if the result contains an error.

pub fn ok(self) -> Option<T>[src]

Converts from Result<T, E> to Option<T> discarding any error.

pub fn err(self) -> Option<E>[src]

Converts from Result<T, E> to Option<E> discarding any value.

pub fn as_ref(&self) -> Result<&T, &E>[src]

Converts from &Result<T, E> to Result<&T, &E>.

pub fn map<U, F>(self, op: F) -> Result<U, E> where
    U: Copy + Sized,
    F: FnOnce(T) -> U, 
[src]

Maps the Result<T, E> to Result<U, E> by mapping the ok value.

pub fn map_or<U, F>(self, default: U, f: F) -> U where
    F: FnOnce(T) -> U, 
[src]

Maps the ok value of the result by applying f or returning the default value.

pub fn map_or_else<U, D, F>(self, default: D, f: F) -> U where
    D: FnOnce(E) -> U,
    F: FnOnce(T) -> U, 
[src]

Maps the Result<T, E> to U by either applying f to the ok value or applying default to the error value.

pub fn map_err<F, O>(self, op: O) -> Result<T, F> where
    F: Copy + Sized,
    O: FnOnce(E) -> F, 
[src]

Maps the Result<T, E> to Result<T,F> by mapping the error value.

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

Returns the contained ok value or a provided default.

pub fn unwrap_or_else<F>(self, op: F) -> T where
    F: FnOnce(E) -> T, 
[src]

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

pub fn to_result(self) -> Result<T, E>[src]

Maps a Result<T, E> to std::result::Result<T, E>.

impl<T, E> Result<T, E> where
    T: Copy + Sized,
    E: Copy + Sized + Debug
[src]

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

Returns the contained ok value.

Panics

Panics if no ok value is contained, with a panic message provided by the error value.

pub fn unwrap(self) -> T[src]

Returns the contained ok value.

Panics

Panics if no ok value is contained, with a panic message including the passed message, and the content of the error value.

impl<T, E> Result<T, E> where
    T: Copy + Sized + Debug,
    E: Copy + Sized
[src]

pub fn expect_err(self, msg: &str) -> E[src]

Returns the contained error value.

Panics

Panics if no error value is contained, with a panic message provided by the ok value.

pub fn unwrap_err(self) -> E[src]

Returns the contained error value.

Panics

Panics if no error value is contained, with a panic message including the passed message, and the content of the ok value.

impl<T, E> Result<T, E> where
    T: Copy + Sized + Default,
    E: Copy + Sized
[src]

pub fn unwrap_or_default(self) -> T[src]

Returns the contained ok value or a default.

Trait Implementations

impl<T: Clone, E: Clone> Clone for Result<T, E> where
    T: Copy + Sized,
    E: Copy + Sized
[src]

impl<T: Copy, E: Copy> Copy for Result<T, E> where
    T: Copy + Sized,
    E: Copy + Sized
[src]

impl<T, E> Debug for Result<T, E> where
    T: Copy + Sized + Debug,
    E: Copy + Sized + Debug
[src]

impl<T, E> Eq for Result<T, E> where
    T: Copy + Sized + PartialEq + Eq,
    E: Copy + Sized + PartialEq + Eq
[src]

impl<T, E> From<Result<T, E>> for Result<T, E> where
    T: Copy + Sized,
    E: Copy + Sized
[src]

impl<T, E> Ord for Result<T, E> where
    T: Copy + Sized + PartialOrd + Ord,
    E: Copy + Sized + PartialOrd + Ord
[src]

impl<T, E> PartialEq<Result<T, E>> for Result<T, E> where
    T: Copy + Sized + PartialEq,
    E: Copy + Sized + PartialEq
[src]

impl<T, E> PartialOrd<Result<T, E>> for Result<T, E> where
    T: Copy + Sized + PartialOrd,
    E: Copy + Sized + PartialOrd
[src]

Auto Trait Implementations

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

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

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

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

impl<T, E> UnwindSafe for Result<T, E> where
    E: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.