pub struct MethodRouter<S = (), E = Infallible> { /* private fields */ }
Expand description
Drop-in replacement for axum::routing::MethodRouter
, which supports
OpenAPI definitions of handlers or services.
Implementations§
Source§impl<S> MethodRouter<S, Infallible>where
S: Clone,
impl<S> MethodRouter<S, Infallible>where
S: Clone,
pub fn on<I, H, T>(self, filter: MethodFilter, handler: I) -> Selfwhere
I: Into<HandlerWithOperation<H, T, S>>,
H: Handler<T, S>,
T: 'static,
S: Send + Sync + 'static,
pub fn delete<I, H, T>(self, handler: I) -> Selfwhere
I: Into<HandlerWithOperation<H, T, S>>,
H: Handler<T, S>,
T: 'static,
S: Send + Sync + 'static,
pub fn get<I, H, T>(self, handler: I) -> Selfwhere
I: Into<HandlerWithOperation<H, T, S>>,
H: Handler<T, S>,
T: 'static,
S: Send + Sync + 'static,
pub fn head<I, H, T>(self, handler: I) -> Selfwhere
I: Into<HandlerWithOperation<H, T, S>>,
H: Handler<T, S>,
T: 'static,
S: Send + Sync + 'static,
pub fn options<I, H, T>(self, handler: I) -> Selfwhere
I: Into<HandlerWithOperation<H, T, S>>,
H: Handler<T, S>,
T: 'static,
S: Send + Sync + 'static,
pub fn patch<I, H, T>(self, handler: I) -> Selfwhere
I: Into<HandlerWithOperation<H, T, S>>,
H: Handler<T, S>,
T: 'static,
S: Send + Sync + 'static,
pub fn post<I, H, T>(self, handler: I) -> Selfwhere
I: Into<HandlerWithOperation<H, T, S>>,
H: Handler<T, S>,
T: 'static,
S: Send + Sync + 'static,
pub fn put<I, H, T>(self, handler: I) -> Selfwhere
I: Into<HandlerWithOperation<H, T, S>>,
H: Handler<T, S>,
T: 'static,
S: Send + Sync + 'static,
pub fn trace<I, H, T>(self, handler: I) -> Selfwhere
I: Into<HandlerWithOperation<H, T, S>>,
H: Handler<T, S>,
T: 'static,
S: Send + Sync + 'static,
pub fn fallback<H, T>(self, handler: H) -> Self
Source§impl<S, E> MethodRouter<S, E>where
S: Clone,
impl<S, E> MethodRouter<S, E>where
S: Clone,
pub fn new() -> Self
Sourcepub fn into_axum(self) -> AxumMethodRouter<S, E>
pub fn into_axum(self) -> AxumMethodRouter<S, E>
Convert method router into axum::routing::MethodRouter
, dropping related OpenAPI definitions.
pub fn on_service<I, Svc>(self, filter: MethodFilter, svc: I) -> Self
pub fn delete_service<I, Svc>(self, svc: I) -> Self
pub fn get_service<I, Svc>(self, svc: I) -> Self
pub fn head_service<I, Svc>(self, svc: I) -> Self
pub fn options_service<I, Svc>(self, svc: I) -> Self
pub fn patch_service<I, Svc>(self, svc: I) -> Self
pub fn post_service<I, Svc>(self, svc: I) -> Self
pub fn put_service<I, Svc>(self, svc: I) -> Self
pub fn trace_service<I, Svc>(self, svc: I) -> Self
pub fn fallback_service<Svc>(self, svc: Svc) -> Self
pub fn layer<L, NewError>(self, layer: L) -> MethodRouter<S, NewError>where
L: Layer<Route<E>> + Clone + Send + Sync + 'static,
L::Service: Service<Request> + Clone + Send + Sync + 'static,
<L::Service as Service<Request>>::Response: IntoResponse + 'static,
<L::Service as Service<Request>>::Error: Into<NewError> + 'static,
<L::Service as Service<Request>>::Future: Send + 'static,
E: 'static,
S: 'static,
NewError: 'static,
pub fn route_layer<L>(self, layer: L) -> MethodRouter<S, E>
pub fn merge(self, other: MethodRouter<S, E>) -> Self
pub fn handle_error<F, T>(self, f: F) -> MethodRouter<S, Infallible>where
F: Clone + Send + Sync + 'static,
HandleError<Route<E>, F, T>: Service<Request, Error = Infallible>,
<HandleError<Route<E>, F, T> as Service<Request>>::Future: Send,
<HandleError<Route<E>, F, T> as Service<Request>>::Response: IntoResponse + Send,
T: 'static,
E: 'static,
S: 'static,
pub fn with_state<S2>(self, state: S) -> MethodRouter<S2, E>
Trait Implementations§
Source§impl<S, E> Debug for MethodRouter<S, E>
impl<S, E> Debug for MethodRouter<S, E>
Source§impl<S, E> Default for MethodRouter<S, E>where
S: Clone,
impl<S, E> Default for MethodRouter<S, E>where
S: Clone,
Source§impl<S, E> From<MethodRouter<S, E>> for MethodRouter<S, E>
impl<S, E> From<MethodRouter<S, E>> for MethodRouter<S, E>
Source§fn from(value: AxumMethodRouter<S, E>) -> Self
fn from(value: AxumMethodRouter<S, E>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<S, E> Freeze for MethodRouter<S, E>
impl<S = (), E = Infallible> !RefUnwindSafe for MethodRouter<S, E>
impl<S, E> Send for MethodRouter<S, E>
impl<S, E> Sync for MethodRouter<S, E>
impl<S, E> Unpin for MethodRouter<S, E>
impl<S = (), E = Infallible> !UnwindSafe for MethodRouter<S, E>
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