base_scheduler/
timeout_error.rs1use crate::OperationError;
5use std::fmt;
6
7#[derive(Debug)]
9pub enum TimeoutError {
10 Elapsed,
12 Clock(OperationError),
14}
15
16impl fmt::Display for TimeoutError {
17 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
18 match self {
19 Self::Elapsed => formatter.write_str("operation timed out"),
20 Self::Clock(error) => write!(formatter, "timeout clock failed: {error}"),
21 }
22 }
23}
24
25impl std::error::Error for TimeoutError {
26 fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
27 match self {
28 Self::Elapsed => None,
29 Self::Clock(error) => Some(error),
30 }
31 }
32}