Trait rocket::http::uri::UriPart

pub trait UriPart: Sealed {
    const DELIMITER: char;
}
Expand description

Marker trait for types that mark a part of a URI.

This trait exists solely to categorize types that mark a part of the URI, currently Path and Query. Said another way, types that implement this trait are marker types that represent a part of a URI at the type-level.

This trait is sealed: it cannot be implemented outside of Rocket.

§Usage

You will find this trait in traits like UriDisplay or structs like Formatter as the bound on a generic parameter: P: UriPart. Because the trait is sealed, the generic type is guaranteed to be instantiated as one of Query or Path, effectively creating two instances of the generic items: UriDisplay<Query> and UriDisplay<Path>, and Formatter<Query> and Formatter<Path>. Unlike having two distinct, non-generic traits, this approach enables succinct, type-checked generic implementations of these items.

Required Associated Constants§

Object Safety§

This trait is not object safe.

Implementors§

§

impl UriPart for Path

§

const DELIMITER: char = '/'

§

impl UriPart for Query

§

const DELIMITER: char = '&'