pub struct GatewayRoute { /* private fields */ }Expand description
A single registered route: an HTTP method, a path matcher, and a handler.
Implementations§
Source§impl GatewayRoute
impl GatewayRoute
Sourcepub fn new(
method: &'static str,
path: &'static str,
handler: fn(&GatewayRequest, &GatewayRouteState) -> GatewayResponse,
) -> Self
pub fn new( method: &'static str, path: &'static str, handler: fn(&GatewayRequest, &GatewayRouteState) -> GatewayResponse, ) -> Self
Returns a route matching path exactly for the given method and handler.
Sourcepub fn prefix(
method: &'static str,
display_path: &'static str,
prefix: &'static str,
handler: fn(&GatewayRequest, &GatewayRouteState) -> GatewayResponse,
) -> Self
pub fn prefix( method: &'static str, display_path: &'static str, prefix: &'static str, handler: fn(&GatewayRequest, &GatewayRouteState) -> GatewayResponse, ) -> Self
Returns a route matching any path that starts with prefix.
display_path is the canonical path reported by GatewayRoute::path.
Sourcepub fn prefix_suffix(
method: &'static str,
display_path: &'static str,
prefix: &'static str,
suffix: &'static str,
handler: fn(&GatewayRequest, &GatewayRouteState) -> GatewayResponse,
) -> Self
pub fn prefix_suffix( method: &'static str, display_path: &'static str, prefix: &'static str, suffix: &'static str, handler: fn(&GatewayRequest, &GatewayRouteState) -> GatewayResponse, ) -> Self
Returns a route matching paths that start with prefix and end with suffix.
display_path is the canonical path reported by GatewayRoute::path.
Trait Implementations§
Source§impl Clone for GatewayRoute
impl Clone for GatewayRoute
Source§fn clone(&self) -> GatewayRoute
fn clone(&self) -> GatewayRoute
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for GatewayRoute
Auto Trait Implementations§
impl Freeze for GatewayRoute
impl RefUnwindSafe for GatewayRoute
impl Send for GatewayRoute
impl Sync for GatewayRoute
impl Unpin for GatewayRoute
impl UnsafeUnpin for GatewayRoute
impl UnwindSafe for GatewayRoute
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