pending-requests 0.1.0

Track in-flight requests and await their responses by key, for request/response protocols multiplexed over a single connection.
Documentation
pub type Result<T> = std::result::Result<T, Error>;

#[derive(thiserror::Error, Debug)]
pub enum Error {
    /// A request with the same key is already pending.
    #[error("key already exists")]
    KeyAlreadyExists,
    /// No pending request was found for the given key.
    #[error("key not found")]
    KeyNotFound,
    /// The request was not answered within its timeout.
    #[error("request timed out")]
    RequestTimeout,
    /// The waiter was dropped before a response could be delivered.
    #[error("receiver dropped")]
    ReceiverDropped,
    /// The pending request was canceled (explicitly or because the
    /// owning `PendingRequests` was dropped) before a response arrived.
    #[error("request canceled")]
    Canceled,
}