pub struct SearchParams { /* private fields */ }Expand description
URLSearchParams: an ordered list of name-value pairs, read from and
written as application/x-www-form-urlencoded.
Implementations§
Source§impl SearchParams
impl SearchParams
pub fn new() -> SearchParams
Sourcepub fn parse(init: &str) -> SearchParams
pub fn parse(init: &str) -> SearchParams
Parses a query string, new URLSearchParams(init); one leading ?
is dropped. Bytes that aren’t UTF-8 once percent-decoded become
U+FFFD, as the spec says.
pub fn is_empty(&self) -> bool
pub fn append(&mut self, name: &str, value: &str)
Sourcepub fn delete(&mut self, name: &str, value: Option<&str>)
pub fn delete(&mut self, name: &str, value: Option<&str>)
Removes every pair named name, or only those whose value is also
value when one is given.
Sourcepub fn has(&self, name: &str, value: Option<&str>) -> bool
pub fn has(&self, name: &str, value: Option<&str>) -> bool
Whether a pair is named name, and has value if one is given.
Sourcepub fn set(&mut self, name: &str, value: &str)
pub fn set(&mut self, name: &str, value: &str)
Gives the first pair named name this value and removes the rest,
or appends the pair if there’s none.
Sourcepub fn sort(&mut self)
pub fn sort(&mut self)
Sorts by name, keeping pairs with the same name in their order. The spec compares UTF-16 code units, which puts U+1F308 before U+FB03.
pub fn iter(&self) -> impl Iterator<Item = (&str, &str)>
Trait Implementations§
Source§impl Clone for SearchParams
impl Clone for SearchParams
Source§fn clone(&self) -> SearchParams
fn clone(&self) -> SearchParams
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SearchParams
impl Debug for SearchParams
Source§impl Default for SearchParams
impl Default for SearchParams
Source§fn default() -> SearchParams
fn default() -> SearchParams
Returns the “default value” for a type. Read more
Source§impl Display for SearchParams
The application/x-www-form-urlencoded serialization: toString().
impl Display for SearchParams
The application/x-www-form-urlencoded serialization: toString().
impl Eq for SearchParams
Source§impl<K, V> FromIterator<(K, V)> for SearchParams
impl<K, V> FromIterator<(K, V)> for SearchParams
Source§fn from_iter<I>(pairs: I) -> SearchParamswhere
I: IntoIterator<Item = (K, V)>,
fn from_iter<I>(pairs: I) -> SearchParamswhere
I: IntoIterator<Item = (K, V)>,
Creates a value from an iterator. Read more
Source§impl Hash for SearchParams
impl Hash for SearchParams
Source§impl PartialEq for SearchParams
impl PartialEq for SearchParams
impl StructuralPartialEq for SearchParams
Auto Trait Implementations§
impl Forget for SearchParams
impl Freeze for SearchParams
impl Move for SearchParams
impl RefUnwindSafe for SearchParams
impl Send for SearchParams
impl Sync for SearchParams
impl Unpin for SearchParams
impl UnsafeUnpin for SearchParams
impl UnwindSafe for SearchParams
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