1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
use std::fmt; use std::io; /// Error type returned as output from the /// [`BlockingPermitFuture`](crate::BlockingPermitFuture) or /// [`Dispatched`](crate::Dispatched) futures if they are canceled. /// /// This only occurs if the associated `Semaphore` is closed or `DispatchPool` /// is dropped, respectively. #[derive(Debug)] pub struct Canceled; impl fmt::Display for Canceled { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "Waiting for a blocking permit or dispatch was canceled") } } impl std::error::Error for Canceled {} impl From<Canceled> for io::Error { fn from(me: Canceled) -> io::Error { io::Error::new(io::ErrorKind::Other, me) } }