#[repr(C)]pub struct With<T, U> {
pub value: T,
pub with: U,
}Expand description
A value with another value.
This type is almost the same as tuple (T, U) except how the type is
displayed by Display. This type only prints first value
only.
Fields§
§value: T§with: UImplementations§
Source§impl<O, T, E> With<O, Result<T, E>>
impl<O, T, E> With<O, Result<T, E>>
Sourcepub fn take(self) -> Result<T, E>
pub fn take(self) -> Result<T, E>
Converts WithResult into Result by unwraping self.
Sourcepub const fn is_ok(&self) -> bool
pub const fn is_ok(&self) -> bool
See Result::is_ok.
Sourcepub const fn is_err(&self) -> bool
pub const fn is_err(&self) -> bool
See Result::is_err.
Sourcepub fn is_err_and(self, f: impl FnOnce(E) -> bool) -> bool
pub fn is_err_and(self, f: impl FnOnce(E) -> bool) -> bool
See Result::is_err_and.
Sourcepub fn ok(self) -> Option<T>
pub fn ok(self) -> Option<T>
See Result::ok.
Sourcepub fn err(self) -> Option<E>
pub fn err(self) -> Option<E>
See Result::err.
Sourcepub fn map<F, U>(self, op: F) -> WithResult<O, U, E>where
F: FnOnce(T) -> U,
pub fn map<F, U>(self, op: F) -> WithResult<O, U, E>where
F: FnOnce(T) -> U,
Applies the given function to the result. See Result::map.
Sourcepub fn map_err<F, D>(self, op: F) -> WithResult<O, T, D>where
F: FnOnce(E) -> D,
pub fn map_err<F, D>(self, op: F) -> WithResult<O, T, D>where
F: FnOnce(E) -> D,
Applies the given function to the result. See Result::map_err.
Sourcepub fn expect(self, msg: &str) -> Twhere
E: Debug,
pub fn expect(self, msg: &str) -> Twhere
E: Debug,
See Result::expect.
Sourcepub fn unwrap(self) -> Twhere
E: Debug,
pub fn unwrap(self) -> Twhere
E: Debug,
See Result::unwrap.
Trait Implementations§
Source§impl<T: Ord, U: Ord> Ord for With<T, U>
impl<T: Ord, U: Ord> Ord for With<T, U>
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, U: PartialOrd> PartialOrd for With<T, U>
impl<T: PartialOrd, U: PartialOrd> PartialOrd for With<T, U>
impl<T: Copy, U: Copy> Copy for With<T, U>
impl<T: Eq, U: Eq> Eq for With<T, U>
impl<T, U> StructuralPartialEq for With<T, U>
Auto Trait Implementations§
impl<T, U> Freeze for With<T, U>
impl<T, U> RefUnwindSafe for With<T, U>where
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for With<T, U>
impl<T, U> Sync for With<T, U>
impl<T, U> Unpin for With<T, U>
impl<T, U> UnwindSafe for With<T, U>where
T: UnwindSafe,
U: 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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