pub enum TryGet<T, E> {
Ok(T),
Err(E),
Pending(Promise<T>),
}
Expand description
Represents all possible value that can be returned from Promise::try_get
or Promise::wait_timeout
methods.
Variants§
Ok(T)
Promise was kept successfully.
Err(E)
Promise will never be kept due to an error.
Pending(Promise<T>)
Promise yet is unresolved.
Implementations§
source§impl<T, E> TryGet<T, E>
impl<T, E> TryGet<T, E>
pub fn ok(self) -> Option<T>
pub fn err(self) -> Option<E>
pub fn pending(self) -> Option<Promise<T>>
sourcepub fn into_res(self) -> Result<Result<T, E>, Promise<T>>
pub fn into_res(self) -> Result<Result<T, E>, Promise<T>>
Converts self
into a nested Result
.
Returns
Ok(Ok(value))
in case ofTryGet::Ok
(value)
.Ok(Err(error))
in case ofTryGet::Err
(error)
.Err(promise)
in case ofTryGet::Pending
(promise)
.
This function basically checks if the promise is resolved (Ok
) or not
yet (Err
).
Trait Implementations§
Auto Trait Implementations§
impl<T, E> !RefUnwindSafe for TryGet<T, E>
impl<T, E> !Send for TryGet<T, E>
impl<T, E> !Sync for TryGet<T, E>
impl<T, E> Unpin for TryGet<T, E>
impl<T, E> !UnwindSafe for TryGet<T, E>
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