Trait RouteBuilder

Source
pub trait RouteBuilder<'a> {
    // Required methods
    fn new(host: &'a str) -> Self;
    fn build(self) -> Result<Uri, Error>;
    fn with_param<T: ToString>(self, name: String, value: T) -> Self;
    fn with_path(self, path: String) -> Self;
    fn with_path_weight(self, path: String, weight: f32) -> Self;
    fn with_scheme(self, scheme: String) -> Self;
}
Expand description

Constructs URL routes from the ground up. Useful in scenarios where the need to dynamically construct routes that may have common properties.

Required Methods§

Source

fn new(host: &'a str) -> Self

New instance of a RouteBuilder.

Source

fn build(self) -> Result<Uri, Error>

Tries to build a URI from path arguments and parameters.

Source

fn with_param<T: ToString>(self, name: String, value: T) -> Self

Add a parameter key/pair to the builder.

Source

fn with_path(self, path: String) -> Self

Add a path argument to the end of the path buffer.

Source

fn with_path_weight(self, path: String, weight: f32) -> Self

Inserts a path argument with the desired weight.

Source

fn with_scheme(self, scheme: String) -> Self

Set the protocol scheme.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§