zrquic 0.1.2

zrquic: A poll system with `quiche` for massive quiche connections.
Documentation
/// A `poll` error.
#[derive(Debug, PartialEq, Eq, thiserror::Error)]
pub enum Error {
    /// A quic protocol error.
    #[error(transparent)]
    Quiche(#[from] quiche::Error),

    /// The operation needs to block to complete, but the blocking operation was
    /// requested to not occur.
    ///
    /// Should retry this operation later.
    #[error("Retry this operation later.")]
    Retry,

    /// Resource is busy, should retry this operation later.
    #[error("Resource is busy.")]
    Busy,

    /// Resource is not found.
    #[error("Resource is not found.")]
    NotFound,

    #[error("Failed to validate client address.")]
    ValidateAddress,
}

impl From<Error> for std::io::Error {
    fn from(value: Error) -> Self {
        match value {
            Error::Quiche(error) => std::io::Error::other(error),
            Error::Retry | Error::Busy => {
                std::io::Error::new(std::io::ErrorKind::WouldBlock, value)
            }

            Error::NotFound => std::io::Error::new(std::io::ErrorKind::NotFound, value),
            Error::ValidateAddress => std::io::Error::other(value),
        }
    }
}

/// Short for `std::result::Result<T, crate::poll::Error>`
pub type Result<T> = std::result::Result<T, Error>;