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§
source§impl QueryParams
impl QueryParams
sourcepub fn from_raw(raw: UrlSearchParams) -> Self
pub fn from_raw(raw: UrlSearchParams) -> Self
Create QueryParams
from web_sys::UrlSearchParams
object.
Trait Implementations§
source§impl Debug for QueryParams
impl Debug for QueryParams
source§impl Default for QueryParams
impl Default for QueryParams
source§impl Display for QueryParams
impl Display for QueryParams
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");