Struct worker::Params [−]
pub struct Params<'k, 'v> { /* fields omitted */ }
Expand description
A list of parameters returned by a route match.
let matched = matcher.at("/users/1")?;
// you can iterate through the keys and values
for (key, value) in matched.params.iter() {
println!("key: {}, value: {}", key, value);
}
// or get a specific value by key
let id = matched.params.get("id");
assert_eq!(id, Some("1"));
Implementations
impl<'k, 'v> Params<'k, 'v>
impl<'k, 'v> Params<'k, 'v>
Returns the value of the first parameter registered under the given key.
pub fn iter(&self) -> ParamsIter<'_, 'k, 'v>
pub fn iter(&self) -> ParamsIter<'_, 'k, 'v>
Returns an iterator over the parameters in the list.
Trait Implementations
impl<'k, 'v> PartialOrd<Params<'k, 'v>> for Params<'k, 'v>
impl<'k, 'v> PartialOrd<Params<'k, 'v>> for Params<'k, 'v>
pub fn partial_cmp(&self, other: &Params<'k, 'v>) -> Option<Ordering>
pub fn partial_cmp(&self, other: &Params<'k, 'v>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
impl<'k, 'v> StructuralEq for Params<'k, 'v>
impl<'k, 'v> StructuralPartialEq for Params<'k, 'v>
Auto Trait Implementations
impl<'k, 'v> RefUnwindSafe for Params<'k, 'v>
impl<'k, 'v> UnwindSafe for Params<'k, 'v>
Blanket Implementations
Mutably borrows from an owned value. Read more