Trait rocket::http::uri::fmt::Part

pub trait Part: Sealed { }
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: Part. 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.

Object Safety§

This trait is not object safe.

Implementors§

§

impl Part for Path

§

impl Part for Query