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