QueryBuilder

Trait QueryBuilder 

Source
pub trait QueryBuilder: Sized {
    // Required method
    fn add_query(&mut self, key: String, value: String);

    // Provided methods
    fn query(self, key: impl Into<String>, value: impl ToString) -> Self { ... }
    fn query_opt(
        self,
        key: impl Into<String>,
        value: Option<impl ToString>,
    ) -> Self { ... }
    fn query_many<I, V>(self, key: impl Into<String>, values: I) -> Self
       where I: IntoIterator<Item = V>,
             V: ToString { ... }
    fn query_many_opt<I, V>(
        self,
        key: impl Into<String>,
        values: Option<I>,
    ) -> Self
       where I: IntoIterator<Item = V>,
             V: ToString { ... }
}
Expand description

Query parameter builder

Required Methods§

Source

fn add_query(&mut self, key: String, value: String)

Add a query parameter

Provided Methods§

Source

fn query(self, key: impl Into<String>, value: impl ToString) -> Self

Add a query parameter

Source

fn query_opt(self, key: impl Into<String>, value: Option<impl ToString>) -> Self

Add optional query parameter (only if Some)

Source

fn query_many<I, V>(self, key: impl Into<String>, values: I) -> Self
where I: IntoIterator<Item = V>, V: ToString,

Add multiple query parameters with the same key

Source

fn query_many_opt<I, V>(self, key: impl Into<String>, values: Option<I>) -> Self
where I: IntoIterator<Item = V>, V: ToString,

Add multiple optional query parameters with the same key

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§