#[non_exhaustive]pub enum TaskFailure {
Aborted,
Error(Arc<dyn Error + Send + Sync + 'static>),
Panic(Arc<str>),
Timeout,
}Expand description
The cause of a task failure: the underlying task ended without producing a rejection value, e.g. it panicked or was cancelled.
Passed to
PromiseRejection::task_failed
so the rejection type can represent the failure.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Aborted
The task was aborted, either through an
AbortHandle or by external cancellation of
the underlying task, such as a tokio runtime shutdown.
Error(Arc<dyn Error + Send + Sync + 'static>)
The task failed with an error, such as when every resolver handle was dropped.
Panic(Arc<str>)
The task panicked. Carries the panic message.
Timeout
A Promise::timeout deadline elapsed.
Trait Implementations§
Source§impl Clone for TaskFailure
impl Clone for TaskFailure
Source§fn clone(&self) -> TaskFailure
fn clone(&self) -> TaskFailure
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TaskFailure
impl Debug for TaskFailure
Source§impl Display for TaskFailure
impl Display for TaskFailure
Source§impl Error for TaskFailure
impl Error for TaskFailure
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<JoinError> for TaskFailure
Available on crate feature tokio only.
impl From<JoinError> for TaskFailure
Available on crate feature
tokio only.Source§impl<T, E> From<TaskFailure> for Promise<T, E>
impl<T, E> From<TaskFailure> for Promise<T, E>
Source§fn from(failure: TaskFailure) -> Self
fn from(failure: TaskFailure) -> Self
Converts a TaskFailure into a failed promise.
The failure is stored as is and mapped through
PromiseRejection::task_failed
on every consumption.
Auto Trait Implementations§
impl !RefUnwindSafe for TaskFailure
impl !UnwindSafe for TaskFailure
impl Freeze for TaskFailure
impl Send for TaskFailure
impl Sync for TaskFailure
impl Unpin for TaskFailure
impl UnsafeUnpin for TaskFailure
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