Skip to main content

PathExt

Trait PathExt 

Source
pub trait PathExt {
    // Required method
    fn with_query(self, key: impl Display, value: impl Display) -> String;
}
Expand description

Fluent query-string builder for path strings produced by typed path helpers.

Automatically imported via autumn_web::prelude.

Required Methods§

Source

fn with_query(self, key: impl Display, value: impl Display) -> String

Append a percent-encoded key=value query parameter.

The first call adds ?key=value; subsequent calls add &key=value. Both key and value are percent-encoded (RFC 3986 §2.1).

§Examples
use autumn_web::paths::PathExt;

let url = "/posts".to_string().with_query("page", 2).with_query("q", "hello world");
assert_eq!(url, "/posts?page=2&q=hello%20world");

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.

Implementations on Foreign Types§

Source§

impl PathExt for String

Source§

fn with_query(self, key: impl Display, value: impl Display) -> String

Implementors§