base_scheduler/
blocking_error.rs1use std::{fmt, io};
5
6#[derive(Debug)]
8pub enum BlockingError {
9 Cancelled,
10 SchedulerClosed,
11 Io(io::Error),
13}
14
15impl fmt::Display for BlockingError {
16 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
17 match self {
18 Self::Cancelled => formatter.write_str("blocking admission cancelled"),
19 Self::SchedulerClosed => formatter.write_str("the scheduler is closed"),
20 Self::Io(error) => error.fmt(formatter),
21 }
22 }
23}
24
25impl std::error::Error for BlockingError {
26 fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
27 match self {
28 Self::Io(error) => Some(error),
29 _ => None,
30 }
31 }
32}