pub enum EndpointError {
Empty,
NoLeadingSlash,
QueryOrFragment,
NotVisibleAscii,
}Expand description
Why a path is not a usable endpoint.
Variants§
Empty
The path was blank.
NoLeadingSlash
The path did not start with /.
Unit rather than carrying the offending path as a &'static str: the
path came in as a borrowed &str with an arbitrary lifetime, so the
only ways to carry it were to copy it into an owned allocation (for an
error variant that fires once, at startup, on a value the caller still
holds) or to name a lifetime on the error type. Neither is worth it —
Endpoint is Copy-cheap to re-parse if the message is not specific
enough, and the caller has the input.
QueryOrFragment
The path carried a ? or a #.
Neither survives the trip from a URL to a server: the client splits the fragment off before the request and the query into a separate component, so an endpoint containing either names a path that can never be requested. Accepting it would register a route that silently never fires, which is the same failure as a typo and is harder to spot.
NotVisibleAscii
The path held a byte that cannot appear in a request line.
Trait Implementations§
Source§impl Clone for EndpointError
impl Clone for EndpointError
impl Copy for EndpointError
Source§impl Debug for EndpointError
impl Debug for EndpointError
Source§impl Display for EndpointError
impl Display for EndpointError
impl Eq for EndpointError
Source§impl Error for EndpointError
impl Error for EndpointError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()