pub struct UrlSearch { /* private fields */ }Implementations
sourceimpl UrlSearch
impl UrlSearch
sourcepub fn new<K, V, VS>(params: impl IntoIterator<Item = (K, VS)>) -> Self where
K: Into<String>,
V: Into<String>,
VS: IntoIterator<Item = V>,
pub fn new<K, V, VS>(params: impl IntoIterator<Item = (K, VS)>) -> Self where
K: Into<String>,
V: Into<String>,
VS: IntoIterator<Item = V>,
Makes a new UrlSearch with the provided parameters.
Examples
UrlSearch::new(vec![
("sort", vec!["date", "name"]),
("category", vec!["top"])
])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
UrlSearchdid not have this key present,Noneis returned. - If the
UrlSearchdid 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
sourceimpl<'de> Deserialize<'de> for UrlSearch
impl<'de> Deserialize<'de> for UrlSearch
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<UrlSearchParams> for UrlSearch
impl From<UrlSearchParams> for UrlSearch
sourcefn 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.
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more