pub struct Router<S = ()>{ /* private fields */ }Expand description
Main router for the elif.rs framework
Implementations§
Source§impl<S> Router<S>
impl<S> Router<S>
Sourcepub fn with_state(state: S) -> Self
pub fn with_state(state: S) -> Self
Create a new router with state
Sourcepub fn get<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
pub fn get<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
Add a GET route
Sourcepub fn post<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
pub fn post<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
Add a POST route
Sourcepub fn put<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
pub fn put<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
Add a PUT route
Sourcepub fn delete<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
pub fn delete<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
Add a DELETE route
Sourcepub fn patch<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
pub fn patch<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Handler<T, S>,
T: 'static,
Add a PATCH route
Sourcepub fn merge(self, other: AxumRouter<S>) -> Self
pub fn merge(self, other: AxumRouter<S>) -> Self
Merge another router
Sourcepub fn nest(self, path: &str, router: AxumRouter<S>) -> Self
pub fn nest(self, path: &str, router: AxumRouter<S>) -> Self
Nest routes under a path prefix
Sourcepub fn into_axum_router(self) -> AxumRouter<S>
pub fn into_axum_router(self) -> AxumRouter<S>
Get the underlying Axum router
Sourcepub fn registry(&self) -> Arc<Mutex<RouteRegistry>>
pub fn registry(&self) -> Arc<Mutex<RouteRegistry>>
Get route registry for introspection
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for Router<S>
impl<S = ()> !RefUnwindSafe for Router<S>
impl<S> Send for Router<S>
impl<S> Sync for Router<S>
impl<S> Unpin for Router<S>
impl<S = ()> !UnwindSafe for Router<S>
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