pub enum ResultExample<T, E> {
Success(T),
Failure(E),
}Variants§
Implementations§
Source§impl<T, E> ResultExample<T, E>
impl<T, E> ResultExample<T, E>
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Behaves like Result::is_ok
Sourcepub fn is_failure(&self) -> bool
pub fn is_failure(&self) -> bool
Behaves like Result::is_err
Sourcepub fn as_success(&self) -> Option<&T>
pub fn as_success(&self) -> Option<&T>
Behaves like Result::as_ref for the Ok variant
Sourcepub fn as_success_mut(&mut self) -> Option<&mut T>
pub fn as_success_mut(&mut self) -> Option<&mut T>
Behaves like Result::as_mut for the Ok variant
Sourcepub fn as_failure(&self) -> Option<&E>
pub fn as_failure(&self) -> Option<&E>
Behaves like Result::as_ref for the Err variant
Sourcepub fn as_failure_mut(&mut self) -> Option<&mut E>
pub fn as_failure_mut(&mut self) -> Option<&mut E>
Behaves like Result::as_mut for the Err variant
Sourcepub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> ResultExample<U, E>
pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> ResultExample<U, E>
Behaves like Result::map
Sourcepub fn map_err<F, O: FnOnce(E) -> F>(self, op: O) -> ResultExample<T, F>
pub fn map_err<F, O: FnOnce(E) -> F>(self, op: O) -> ResultExample<T, F>
Behaves like Result::map_err
Sourcepub fn unwrap(self) -> T
pub fn unwrap(self) -> T
Behaves like Result::unwrap
Sourcepub fn unwrap_or(self, default: T) -> T
pub fn unwrap_or(self, default: T) -> T
Behaves like Result::unwrap_or
Sourcepub fn unwrap_or_else<F: FnOnce(E) -> T>(self, op: F) -> T
pub fn unwrap_or_else<F: FnOnce(E) -> T>(self, op: F) -> T
Behaves like Result::unwrap_or_else
Trait Implementations§
Source§impl<T: Clone, E: Clone> Clone for ResultExample<T, E>
impl<T: Clone, E: Clone> Clone for ResultExample<T, E>
Source§fn clone(&self) -> ResultExample<T, E>
fn clone(&self) -> ResultExample<T, E>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T, E> From<Result<T, E>> for ResultExample<T, E>
impl<T, E> From<Result<T, E>> for ResultExample<T, E>
Source§impl<T, E> From<ResultExample<T, E>> for Result<T, E>
impl<T, E> From<ResultExample<T, E>> for Result<T, E>
Source§fn from(val: ResultExample<T, E>) -> Self
fn from(val: ResultExample<T, E>) -> Self
Converts to this type from the input type.
Source§impl<T: Ord, E: Ord> Ord for ResultExample<T, E>
impl<T: Ord, E: Ord> Ord for ResultExample<T, E>
Source§fn cmp(&self, other: &ResultExample<T, E>) -> Ordering
fn cmp(&self, other: &ResultExample<T, E>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialOrd, E: PartialOrd> PartialOrd for ResultExample<T, E>
impl<T: PartialOrd, E: PartialOrd> PartialOrd for ResultExample<T, E>
impl<T: Copy, E: Copy> Copy for ResultExample<T, E>
impl<T: Eq, E: Eq> Eq for ResultExample<T, E>
impl<T, E> StructuralPartialEq for ResultExample<T, E>
Auto Trait Implementations§
impl<T, E> Freeze for ResultExample<T, E>
impl<T, E> RefUnwindSafe for ResultExample<T, E>where
T: RefUnwindSafe,
E: RefUnwindSafe,
impl<T, E> Send for ResultExample<T, E>
impl<T, E> Sync for ResultExample<T, E>
impl<T, E> Unpin for ResultExample<T, E>
impl<T, E> UnwindSafe for ResultExample<T, E>where
T: UnwindSafe,
E: UnwindSafe,
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