Struct Route

Source
pub struct Route<'a, V> { /* private fields */ }

Implementations§

Source§

impl<'a, V> Route<'a, V>

Source

pub fn new(regex: &'a str, params: Vec<&'a str>) -> Self

Construct a Route from its base constituents (raw regex and parameter names).

Source

pub fn set(&mut self, method: &'a str, handler: V)

Inserts (and potentially overrides) a handler for a specific request method.

Source

pub fn regex(&self) -> &str

Returns an immutable reference to the route’s raw regex.

Source

pub fn params(&self) -> &[&str]

Returns an immutable string slice of the route’s parameter names.

Source

pub fn handlers(&self) -> &HashMap<&'a str, V>

Returns an immutable reference to the route’s map of methods to handlers.

Auto Trait Implementations§

§

impl<'a, V> Freeze for Route<'a, V>

§

impl<'a, V> RefUnwindSafe for Route<'a, V>
where V: RefUnwindSafe,

§

impl<'a, V> Send for Route<'a, V>
where V: Send,

§

impl<'a, V> Sync for Route<'a, V>
where V: Sync,

§

impl<'a, V> Unpin for Route<'a, V>
where V: Unpin,

§

impl<'a, V> UnwindSafe for Route<'a, V>
where V: UnwindSafe,

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.