pub enum State<T = (), E = ()> {
Pending,
Resolve(T),
Resolved,
Reject(E),
Rejected,
}
Variants§
Implementations§
Source§impl<T, E> State<T, E>
impl<T, E> State<T, E>
pub fn is_pending(&self) -> bool
pub fn is_resolve(&self) -> bool
pub fn is_resolved(&self) -> bool
pub fn is_reject(&self) -> bool
pub fn is_rejected(&self) -> bool
pub fn resolve(self) -> Option<T>
pub fn reject(self) -> Option<E>
pub fn as_ref(&self) -> State<&T, &E>
pub fn as_mut(&mut self) -> State<&mut T, &mut E>
pub fn into_result(self) -> Option<Result<T, E>>
pub fn map<U, F>(self, op: F) -> State<U, E>where
F: FnOnce(T) -> U,
pub fn map_err<F, O>(self, op: F) -> State<T, O>where
F: FnOnce(E) -> O,
pub fn and<U>(self, res: State<U, E>) -> State<U, E>
pub fn and_then<U, F>(self, op: F) -> State<U, E>
pub fn or<O>(self, res: State<T, O>) -> State<T, O>
pub fn or_else<O, F>(self, op: F) -> State<T, O>
pub fn unwrap_or(self, or: T) -> T
pub fn unwrap_or_else<F>(self, f: F) -> Twhere
F: FnOnce() -> T,
pub fn take(&mut self) -> State<T, E>
Source§impl<T, E> State<T, E>where
T: Debug,
impl<T, E> State<T, E>where
T: Debug,
pub fn unwrap_reject(self) -> E
pub fn expect_reject(self, msg: &str) -> E
Trait Implementations§
Source§impl<T: Ord, E: Ord> Ord for State<T, E>
impl<T: Ord, E: Ord> Ord for State<T, E>
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 State<T, E>
impl<T: PartialOrd, E: PartialOrd> PartialOrd for State<T, E>
impl<T: Copy, E: Copy> Copy for State<T, E>
impl<T: Eq, E: Eq> Eq for State<T, E>
impl<T, E> StructuralPartialEq for State<T, E>
Auto Trait Implementations§
impl<T, E> Freeze for State<T, E>
impl<T, E> RefUnwindSafe for State<T, E>where
T: RefUnwindSafe,
E: RefUnwindSafe,
impl<T, E> Send for State<T, E>
impl<T, E> Sync for State<T, E>
impl<T, E> Unpin for State<T, E>
impl<T, E> UnwindSafe for State<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