#[repr(C, u64)]pub enum StableResult<T, E> {
Ok(T),
Err(E),
}
Expand description
Same as Result
but provides a stable memory layout
Variants§
Implementations§
Source§impl<T: Debug, E: Debug> StableResult<T, E>
impl<T: Debug, E: Debug> StableResult<T, E>
Sourcepub fn unwrap_err(self) -> E
pub fn unwrap_err(self) -> E
Returns the inner error if Err
, panics otherwise
Sourcepub fn map<U, O: FnOnce(T) -> U>(self, op: O) -> StableResult<U, E>
pub fn map<U, O: FnOnce(T) -> U>(self, op: O) -> StableResult<U, E>
Maps ok values, leaving error values untouched
Sourcepub fn map_err<F, O: FnOnce(E) -> F>(self, op: O) -> StableResult<T, F>
pub fn map_err<F, O: FnOnce(E) -> F>(self, op: O) -> StableResult<T, F>
Maps error values, leaving ok values untouched
Trait Implementations§
Source§impl<T, E> From<Result<T, E>> for StableResult<T, E>
impl<T, E> From<Result<T, E>> for StableResult<T, E>
Source§impl<T, E> From<StableResult<T, E>> for Result<T, E>
impl<T, E> From<StableResult<T, E>> for Result<T, E>
Source§fn from(result: StableResult<T, E>) -> Self
fn from(result: StableResult<T, E>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<T, E> Freeze for StableResult<T, E>
impl<T, E> RefUnwindSafe for StableResult<T, E>where
T: RefUnwindSafe,
E: RefUnwindSafe,
impl<T, E> Send for StableResult<T, E>
impl<T, E> Sync for StableResult<T, E>
impl<T, E> Unpin for StableResult<T, E>
impl<T, E> UnwindSafe for StableResult<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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more