Struct gloo_net::http::QueryParams

source ·
pub struct QueryParams { /* private fields */ }
Available on crate feature http only.
Expand description

A sequence of URL query parameters, wrapping web_sys::UrlSearchParams.

Implementations§

Create a new empty query parameters object.

Append a parameter to the query string.

Get the value of a parameter. If the parameter has multiple occurrences, the first value is returned.

Get all associated values of a parameter.

Remove all occurrences of a parameter from the query string.

Iterate over (name, value) pairs of the query parameters.

Trait Implementations§

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

The formatted query parameters ready to be used in a URL query string.

Examples

The resulting string does not contain a leading ? and is properly encoded:

use gloo_net::http::QueryParams;

let params = QueryParams::new();
params.append("a", "1");
params.append("b", "2");
assert_eq!(params.to_string(), "a=1&b=2".to_string());

params.append("key", "ab&c");
assert_eq!(params.to_string(), "a=1&b=2&key=ab%26c");
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.