servlet 1.0.0

A small application runtime with an explicit operational contract
Documentation
//! Errors retain fixed categories rather than URLs, headers, or native transport chains.

/// A managed HTTP request, body, configuration, or ownership failure.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum ClientError {
    /// Invalid explicit origin, limits, header policy, or trust root.
    Configuration,
    /// Ambient TLS root overrides would change the default platform trust policy.
    AmbientConfiguration,
    /// Managed resource registration failed.
    Registration,
    /// The requested target is not a relative path within the approved origin.
    Destination,
    /// The bounded capacity-wait queue is full.
    Capacity,
    /// The configured capacity-wait allowance expired before the total deadline.
    CapacityTimeout,
    /// The client has entered managed cleanup or was explicitly closed.
    Closed,
    /// The original total/inherited request deadline expired.
    Deadline,
    /// Native connection establishment exceeded its configured limit.
    ConnectTimeout,
    /// Response/header reads or caller-held body progress exceeded the idle limit.
    ReadTimeout,
    /// Native transport/protocol failure, without retaining secret-bearing details.
    Transport,
    /// The supplied request body exceeded the configured byte allowance.
    RequestTooLarge,
    /// Wire or decoded response-body bytes exceeded the configured allowance.
    ResponseTooLarge,
}
impl std::fmt::Display for ClientError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            Self::Configuration => "invalid managed HTTP client configuration",
            Self::AmbientConfiguration => "ambient TLS root overrides are unsupported",
            Self::Registration => "managed HTTP client registration rejected",
            Self::Destination => "HTTP destination is outside the approved origin",
            Self::Capacity => "HTTP client capacity wait queue is full",
            Self::CapacityTimeout => "HTTP client capacity wait allowance expired",
            Self::Closed => "HTTP client is closed",
            Self::Deadline => "HTTP client operation deadline expired",
            Self::ConnectTimeout => "HTTP client connection allowance expired",
            Self::ReadTimeout => "HTTP client response progress allowance expired",
            Self::Transport => "HTTP client transport failed",
            Self::RequestTooLarge => "HTTP client request body exceeds its allowance",
            Self::ResponseTooLarge => "HTTP client response body exceeds its allowance",
        })
    }
}
impl std::error::Error for ClientError {}
impl ClientError {
    pub(super) fn transport(error: reqwest::Error) -> Self {
        if error.is_timeout() {
            if error.is_connect() {
                Self::ConnectTimeout
            } else {
                Self::ReadTimeout
            }
        } else {
            Self::Transport
        }
    }
}