Struct httprouter::Params[][src]

pub struct Params(pub Vec<Param, Global>);
Expand description

A Vec of Param returned by a route match. There are two ways to retrieve the value of a parameter:

  1. by the name of the parameter
 let user = params.get("user"); // defined by :user or *user
  1. by the index of the parameter. This way you can also get the name (key)
 let third_key = &params[2].key;   // the name of the 3rd parameter
 let third_value = &params[2].value; // the value of the 3rd parameter

Implementations

impl Params[src]

pub fn get(&self, name: impl AsRef<str>) -> Option<&str>[src]

Returns the value of the first Param whose key matches the given name.

pub fn is_empty(&self) -> bool[src]

pub fn push(&mut self, p: Param)[src]

Inserts a URL parameter into the vector

Trait Implementations

impl Debug for Params[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl Default for Params[src]

pub fn default() -> Params[src]

Returns the “default value” for a type. Read more

impl Index<usize> for Params[src]

type Output = Param

The returned type after indexing.

pub fn index(&self, i: usize) -> &Param[src]

Performs the indexing (container[index]) operation. Read more

impl IndexMut<usize> for Params[src]

pub fn index_mut(&mut self, i: usize) -> &mut Param[src]

Performs the mutable indexing (container[index]) operation. Read more

impl IntoIterator for Params[src]

type IntoIter = IntoIter<Param, Global>

Which kind of iterator are we turning this into?

type Item = Param

The type of the elements being iterated over.

pub fn into_iter(self) -> <Params as IntoIterator>::IntoIter[src]

Creates an iterator from a value. Read more

impl PartialEq<Params> for Params[src]

pub fn eq(&self, other: &Params) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

pub fn ne(&self, other: &Params) -> bool[src]

This method tests for !=.

impl StructuralPartialEq for Params[src]

Auto Trait Implementations

impl RefUnwindSafe for Params

impl Send for Params

impl Sync for Params

impl Unpin for Params

impl UnwindSafe for Params

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.