pub struct UrlSearch { /* private fields */ }
Implementations§
source§impl UrlSearch
impl UrlSearch
sourcepub fn new<K, V, VS>(params: impl IntoIterator<Item = (K, VS)>) -> Selfwhere
K: Into<String>,
V: Into<String>,
VS: IntoIterator<Item = V>,
pub fn new<K, V, VS>(params: impl IntoIterator<Item = (K, VS)>) -> Selfwhere K: Into<String>, V: Into<String>, VS: IntoIterator<Item = V>,
sourcepub fn contains_key(&self, key: impl AsRef<str>) -> bool
pub fn contains_key(&self, key: impl AsRef<str>) -> bool
Returns true
if the UrlSearch
contains a value for the specified key.
sourcepub fn get(&self, key: impl AsRef<str>) -> Option<&Vec<String>>
pub fn get(&self, key: impl AsRef<str>) -> Option<&Vec<String>>
Returns a reference to values corresponding to the key.
sourcepub fn get_mut(&mut self, key: impl AsRef<str>) -> Option<&mut Vec<String>>
pub fn get_mut(&mut self, key: impl AsRef<str>) -> Option<&mut Vec<String>>
Returns a mutable reference to values corresponding to the key.
sourcepub fn push_value<'a>(&mut self, key: impl Into<Cow<'a, str>>, value: String)
pub fn push_value<'a>(&mut self, key: impl Into<Cow<'a, str>>, value: String)
Push the value into the vector of values corresponding to the key.
- If the key and values are not present, they will be crated.
sourcepub fn insert(&mut self, key: String, values: Vec<String>) -> Option<Vec<String>>
pub fn insert(&mut self, key: String, values: Vec<String>) -> Option<Vec<String>>
Inserts a key-values pair into the UrlSearch
.
- If the
UrlSearch
did not have this key present,None
is returned. - If the
UrlSearch
did have this key present, old values are overwritten by new ones, and old values are returned. The key is not updated.
sourcepub fn remove(&mut self, key: impl AsRef<str>) -> Option<Vec<String>>
pub fn remove(&mut self, key: impl AsRef<str>) -> Option<Vec<String>>
Removes a key from the UrlSearch
, returning values at the key
if the key was previously in the UrlSearch
.
sourcepub fn iter(&self) -> impl Iterator<Item = (&String, &Vec<String>)>
pub fn iter(&self) -> impl Iterator<Item = (&String, &Vec<String>)>
Gets an iterator over the entries of the UrlSearch
, sorted by key.
sourcepub fn invalid_components(&self) -> &[String]
pub fn invalid_components(&self) -> &[String]
Get invalid components.
Undecodable / unparsable components are invalid.
sourcepub fn invalid_components_mut(&mut self) -> &mut Vec<String>
pub fn invalid_components_mut(&mut self) -> &mut Vec<String>
Get mutable invalid components.
Undecodable / unparsable components are invalid.
Trait Implementations§
source§impl From<UrlSearchParams> for UrlSearch
impl From<UrlSearchParams> for UrlSearch
source§fn from(params: UrlSearchParams) -> Self
fn from(params: UrlSearchParams) -> Self
Creates a new UrlSearch
from the browser native UrlSearchParams
.
UrlSearch
’s components are decoded if possible. When decoding fails, the component is cloned
into invalid_components
and the original value is used.
source§impl PartialEq<UrlSearch> for UrlSearch
impl PartialEq<UrlSearch> for UrlSearch
impl Eq for UrlSearch
impl StructuralEq for UrlSearch
impl StructuralPartialEq for UrlSearch
Auto Trait Implementations§
impl RefUnwindSafe for UrlSearch
impl Send for UrlSearch
impl Sync for UrlSearch
impl Unpin for UrlSearch
impl UnwindSafe for UrlSearch
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.