Skip to main content

RouteMatch

Struct RouteMatch 

Source
pub struct RouteMatch<'a> {
    pub route: &'a Route,
    pub params: Vec<(&'a str, &'a str)>,
}
Expand description

A matched route with extracted parameters.

Fields§

§route: &'a Route

The matched route.

§params: Vec<(&'a str, &'a str)>

Extracted path parameters.

Implementations§

Source§

impl<'a> RouteMatch<'a>

Source

pub fn get_param(&self, name: &str) -> Option<&str>

Get a parameter value by name.

Source

pub fn param_count(&self) -> usize

Number of extracted parameters.

Source

pub fn is_empty(&self) -> bool

Returns true if there are no extracted parameters.

Source

pub fn iter(&self) -> impl Iterator<Item = (&str, &str)> + '_

Iterate over extracted parameters as (name, value) pairs.

Source

pub fn is_param_uuid(&self, name: &str) -> Option<bool>

Returns true if the route declares the given param as a UUID converter.

Source

pub fn get_param_int(&self, name: &str) -> Option<Result<i64, ParseIntError>>

Parse a parameter as i64.

Source

pub fn get_param_i32(&self, name: &str) -> Option<Result<i32, ParseIntError>>

Parse a parameter as i32.

Source

pub fn get_param_u64(&self, name: &str) -> Option<Result<u64, ParseIntError>>

Parse a parameter as u64.

Source

pub fn get_param_u32(&self, name: &str) -> Option<Result<u32, ParseIntError>>

Parse a parameter as u32.

Source

pub fn get_param_float( &self, name: &str, ) -> Option<Result<f64, ParseFloatError>>

Parse a parameter as f64.

Source

pub fn get_param_f32(&self, name: &str) -> Option<Result<f32, ParseFloatError>>

Parse a parameter as f32.

Trait Implementations§

Source§

impl<'a> Debug for RouteMatch<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for RouteMatch<'a>

§

impl<'a> RefUnwindSafe for RouteMatch<'a>

§

impl<'a> Send for RouteMatch<'a>

§

impl<'a> Sync for RouteMatch<'a>

§

impl<'a> Unpin for RouteMatch<'a>

§

impl<'a> UnwindSafe for RouteMatch<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.