pub struct RouteBuilder { /* private fields */ }Expand description
Builder returned after registering a route, enabling .name() chaining
Implementations§
Source§impl RouteBuilder
impl RouteBuilder
Sourcepub fn group<F>(self, prefix: &str, builder_fn: F) -> GroupBuilder
pub fn group<F>(self, prefix: &str, builder_fn: F) -> GroupBuilder
Create a route group with a shared prefix
Source§impl RouteBuilder
impl RouteBuilder
Sourcepub fn middleware<M: Middleware + 'static>(self, middleware: M) -> RouteBuilder
pub fn middleware<M: Middleware + 'static>(self, middleware: M) -> RouteBuilder
Sourcepub fn middleware_boxed(self, middleware: BoxedMiddleware) -> RouteBuilder
pub fn middleware_boxed(self, middleware: BoxedMiddleware) -> RouteBuilder
Apply pre-boxed middleware to the most recently registered route (Used internally by route macros)
Sourcepub fn get<H, Fut>(self, path: &str, handler: H) -> RouteBuilder
pub fn get<H, Fut>(self, path: &str, handler: H) -> RouteBuilder
Register a GET route (for chaining without .name())
Sourcepub fn post<H, Fut>(self, path: &str, handler: H) -> RouteBuilder
pub fn post<H, Fut>(self, path: &str, handler: H) -> RouteBuilder
Register a POST route (for chaining without .name())
Sourcepub fn put<H, Fut>(self, path: &str, handler: H) -> RouteBuilder
pub fn put<H, Fut>(self, path: &str, handler: H) -> RouteBuilder
Register a PUT route (for chaining without .name())
Trait Implementations§
Source§impl From<RouteBuilder> for Router
impl From<RouteBuilder> for Router
Source§fn from(builder: RouteBuilder) -> Self
fn from(builder: RouteBuilder) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !Freeze for RouteBuilder
impl !RefUnwindSafe for RouteBuilder
impl Send for RouteBuilder
impl Sync for RouteBuilder
impl Unpin for RouteBuilder
impl !UnwindSafe for RouteBuilder
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more