pub struct RouteEntry {
pub method: Method,
pub path: String,
/* private fields */
}Expand description
A registered route with its handler.
Fields§
§method: MethodThe HTTP method for this route.
path: StringThe path pattern for this route.
Implementations§
Source§impl RouteEntry
impl RouteEntry
Sourcepub fn new<H>(method: Method, path: impl Into<String>, handler: H) -> Self
pub fn new<H>(method: Method, path: impl Into<String>, handler: H) -> Self
Creates a new route entry.
Note: The handler’s future must not outlive the borrow of the context/request passed to it.
Sourcepub async fn call(&self, ctx: &RequestContext, req: &mut Request) -> Response
pub async fn call(&self, ctx: &RequestContext, req: &mut Request) -> Response
Calls the handler with the given context and request.
Trait Implementations§
Source§impl Clone for RouteEntry
impl Clone for RouteEntry
Source§fn clone(&self) -> RouteEntry
fn clone(&self) -> RouteEntry
Returns a duplicate of the value. Read more
1.0.0 · 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 Freeze for RouteEntry
impl !RefUnwindSafe for RouteEntry
impl Send for RouteEntry
impl Sync for RouteEntry
impl Unpin for RouteEntry
impl !UnwindSafe for RouteEntry
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).