pub struct QueryString(/* private fields */);Expand description
§Query Parameters
let query = QueryString::from_iter([
("foo", "bar"),
("fizz", "buzz"),
]);
assert_eq!(query.first("foo"), Some("bar"));
assert_eq!(query.first("fizz"), Some("buzz"));
assert!(query.first("nonexistent").is_none());Implementations§
Source§impl QueryString
impl QueryString
Sourcepub fn first(&self, key: &str) -> Option<&str>
pub fn first(&self, key: &str) -> Option<&str>
Returns the first occurrence of a value for a given key, if it exists.
Sourcepub fn values_for(&self, key: &str) -> impl Iterator<Item = &str>
pub fn values_for(&self, key: &str) -> impl Iterator<Item = &str>
Provides an iterator over all values for a given key.
Sourcepub fn add(&mut self, key: impl Into<String>, value: impl Into<String>)
pub fn add(&mut self, key: impl Into<String>, value: impl Into<String>)
Adds a new key-value pair to the query.
Sourcepub fn insert_many<P, Q>(&mut self, params: P)where
P: IntoIterator<Item = Q>,
Q: Into<QueryParameter>,
pub fn insert_many<P, Q>(&mut self, params: P)where
P: IntoIterator<Item = Q>,
Q: Into<QueryParameter>,
adds many key-value pairs to the query.
Trait Implementations§
Source§impl Clone for QueryString
impl Clone for QueryString
Source§fn clone(&self) -> QueryString
fn clone(&self) -> QueryString
Returns a duplicate of the value. Read more
1.0.0 · 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 QueryString
impl Debug for QueryString
Source§impl Default for QueryString
impl Default for QueryString
Source§fn default() -> QueryString
fn default() -> QueryString
Returns the “default value” for a type. Read more
Source§impl<T> FromIterator<T> for QueryStringwhere
T: Into<QueryParameter>,
impl<T> FromIterator<T> for QueryStringwhere
T: Into<QueryParameter>,
Source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl IntoIterator for QueryString
impl IntoIterator for QueryString
Source§impl PartialEq for QueryString
impl PartialEq for QueryString
impl Eq for QueryString
impl StructuralPartialEq for QueryString
Auto Trait Implementations§
impl Freeze for QueryString
impl RefUnwindSafe for QueryString
impl Send for QueryString
impl Sync for QueryString
impl Unpin for QueryString
impl UnsafeUnpin for QueryString
impl UnwindSafe for QueryString
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