pub struct GatewayRoutes { /* private fields */ }Expand description
A route table paired with the state handlers dispatch against.
Implementations§
Source§impl GatewayRoutes
impl GatewayRoutes
Sourcepub fn new(routes: Vec<GatewayRoute>) -> Self
pub fn new(routes: Vec<GatewayRoute>) -> Self
Returns a route table over routes with fresh in-memory state.
Sourcepub fn with_state(routes: Vec<GatewayRoute>, state: GatewayRouteState) -> Self
pub fn with_state(routes: Vec<GatewayRoute>, state: GatewayRouteState) -> Self
Returns a route table over routes sharing the supplied state.
Sourcepub fn handle(&self, request: &GatewayRequest) -> GatewayResponse
pub fn handle(&self, request: &GatewayRequest) -> GatewayResponse
Dispatches request to the matching route, returning its response.
Returns 405 when the path exists under a different method and 404 when no route matches the path at all.
Sourcepub fn state(&self) -> &GatewayRouteState
pub fn state(&self) -> &GatewayRouteState
Returns the shared route state.
Trait Implementations§
Source§impl Clone for GatewayRoutes
impl Clone for GatewayRoutes
Source§fn clone(&self) -> GatewayRoutes
fn clone(&self) -> GatewayRoutes
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 moreAuto Trait Implementations§
impl !RefUnwindSafe for GatewayRoutes
impl !UnwindSafe for GatewayRoutes
impl Freeze for GatewayRoutes
impl Send for GatewayRoutes
impl Sync for GatewayRoutes
impl Unpin for GatewayRoutes
impl UnsafeUnpin for GatewayRoutes
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