blocking-permit 1.2.0

Permits and a thread pool for blocking operations
Documentation
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)
    }
}