Struct gloo::net::http::QueryParams
source · pub struct QueryParams { /* private fields */ }
Available on crate features
net
and http
only.Expand description
A sequence of URL query parameters, wrapping web_sys::UrlSearchParams
.
Implementations§
source§impl QueryParams
impl QueryParams
sourcepub fn new() -> QueryParams
pub fn new() -> QueryParams
Create a new empty query parameters object.
sourcepub fn from_raw(raw: UrlSearchParams) -> QueryParams
pub fn from_raw(raw: UrlSearchParams) -> QueryParams
Create QueryParams
from web_sys::UrlSearchParams
object.
sourcepub fn get(&self, name: &str) -> Option<String>
pub fn get(&self, name: &str) -> Option<String>
Get the value of a parameter. If the parameter has multiple occurrences, the first value is returned.
Trait Implementations§
source§impl Debug for QueryParams
impl Debug for QueryParams
source§impl Default for QueryParams
impl Default for QueryParams
source§fn default() -> QueryParams
fn default() -> QueryParams
Returns the “default value” for a type. Read more
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");
Auto Trait Implementations§
impl RefUnwindSafe for QueryParams
impl !Send for QueryParams
impl !Sync for QueryParams
impl Unpin for QueryParams
impl UnwindSafe for QueryParams
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more