pub struct Router { /* private fields */ }Expand description
A validated, ordered set of routes.
Serialises as its list of routes; deserialising validates them
again, so a stored configuration cannot bypass Router::new.
Implementations§
Source§impl Router
impl Router
Sourcepub fn new(routes: Vec<Route>) -> Result<Self, RouteError>
pub fn new(routes: Vec<Route>) -> Result<Self, RouteError>
Validates routes and orders them for matching.
§Errors
Returns a RouteError for an empty or duplicate name, a prefix
that does not start with /, an empty host or invalid method, a
document root that is not a directory, or two routes with equal
priority and constraints.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Router
impl<'de> Deserialize<'de> for Router
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Router
impl StructuralPartialEq for Router
Auto Trait Implementations§
impl Forget for Router
impl Freeze for Router
impl RefUnwindSafe for Router
impl Send for Router
impl Sync for Router
impl Unpin for Router
impl UnsafeUnpin for Router
impl UnwindSafe for Router
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.