pub struct MethodRouter<S = (), E = Infallible> { /* private fields */ }
Expand description
A light wrapper around axum’s MethodRouter
(or ApiMethodRouter
if the aide
feature is enabled).
However, responses are expected to be IntoCodecResponse
(instead of
IntoResponse
), as they are automatically
converted to the appropriate response type when appropriate.
Implementations§
Source§impl<S> MethodRouter<S, Infallible>
impl<S> MethodRouter<S, Infallible>
Sourcepub fn delete<T, H, I, D>(self, handler: H) -> Self
pub fn delete<T, H, I, D>(self, handler: H) -> Self
Route delete
requests to the given handler. See axum::routing::MethodRouter::delete
for more details.
Sourcepub fn delete_with<T, H, I, D, F>(self, handler: H, transform: F) -> Selfwhere
H: CodecHandler<T, I, D, S> + Clone + Send + Sync + 'static,
I: Input + Send + Sync + 'static,
D: IntoCodecResponse + Send + 'static,
S: Clone + Send + Sync + 'static,
T: Sync + 'static,
F: FnOnce(TransformOperation<'_>) -> TransformOperation<'_>,
pub fn delete_with<T, H, I, D, F>(self, handler: H, transform: F) -> Selfwhere
H: CodecHandler<T, I, D, S> + Clone + Send + Sync + 'static,
I: Input + Send + Sync + 'static,
D: IntoCodecResponse + Send + 'static,
S: Clone + Send + Sync + 'static,
T: Sync + 'static,
F: FnOnce(TransformOperation<'_>) -> TransformOperation<'_>,
Route delete
requests to the given handler. See axum::routing::MethodRouter::delete
for more details.
Sourcepub fn get<T, H, I, D>(self, handler: H) -> Self
pub fn get<T, H, I, D>(self, handler: H) -> Self
Route get
requests to the given handler. See axum::routing::MethodRouter::get
for more details.
Sourcepub fn get_with<T, H, I, D, F>(self, handler: H, transform: F) -> Selfwhere
H: CodecHandler<T, I, D, S> + Clone + Send + Sync + 'static,
I: Input + Send + Sync + 'static,
D: IntoCodecResponse + Send + 'static,
S: Clone + Send + Sync + 'static,
T: Sync + 'static,
F: FnOnce(TransformOperation<'_>) -> TransformOperation<'_>,
pub fn get_with<T, H, I, D, F>(self, handler: H, transform: F) -> Selfwhere
H: CodecHandler<T, I, D, S> + Clone + Send + Sync + 'static,
I: Input + Send + Sync + 'static,
D: IntoCodecResponse + Send + 'static,
S: Clone + Send + Sync + 'static,
T: Sync + 'static,
F: FnOnce(TransformOperation<'_>) -> TransformOperation<'_>,
Route get
requests to the given handler. See axum::routing::MethodRouter::get
for more details.
Sourcepub fn head<T, H, I, D>(self, handler: H) -> Self
pub fn head<T, H, I, D>(self, handler: H) -> Self
Route head
requests to the given handler. See axum::routing::MethodRouter::head
for more details.
Sourcepub fn head_with<T, H, I, D, F>(self, handler: H, transform: F) -> Selfwhere
H: CodecHandler<T, I, D, S> + Clone + Send + Sync + 'static,
I: Input + Send + Sync + 'static,
D: IntoCodecResponse + Send + 'static,
S: Clone + Send + Sync + 'static,
T: Sync + 'static,
F: FnOnce(TransformOperation<'_>) -> TransformOperation<'_>,
pub fn head_with<T, H, I, D, F>(self, handler: H, transform: F) -> Selfwhere
H: CodecHandler<T, I, D, S> + Clone + Send + Sync + 'static,
I: Input + Send + Sync + 'static,
D: IntoCodecResponse + Send + 'static,
S: Clone + Send + Sync + 'static,
T: Sync + 'static,
F: FnOnce(TransformOperation<'_>) -> TransformOperation<'_>,
Route head
requests to the given handler. See axum::routing::MethodRouter::head
for more details.
Sourcepub fn options<T, H, I, D>(self, handler: H) -> Self
pub fn options<T, H, I, D>(self, handler: H) -> Self
Route options
requests to the given handler. See axum::routing::MethodRouter::options
for more details.
Sourcepub fn options_with<T, H, I, D, F>(self, handler: H, transform: F) -> Selfwhere
H: CodecHandler<T, I, D, S> + Clone + Send + Sync + 'static,
I: Input + Send + Sync + 'static,
D: IntoCodecResponse + Send + 'static,
S: Clone + Send + Sync + 'static,
T: Sync + 'static,
F: FnOnce(TransformOperation<'_>) -> TransformOperation<'_>,
pub fn options_with<T, H, I, D, F>(self, handler: H, transform: F) -> Selfwhere
H: CodecHandler<T, I, D, S> + Clone + Send + Sync + 'static,
I: Input + Send + Sync + 'static,
D: IntoCodecResponse + Send + 'static,
S: Clone + Send + Sync + 'static,
T: Sync + 'static,
F: FnOnce(TransformOperation<'_>) -> TransformOperation<'_>,
Route options
requests to the given handler. See axum::routing::MethodRouter::options
for more details.
Sourcepub fn patch<T, H, I, D>(self, handler: H) -> Self
pub fn patch<T, H, I, D>(self, handler: H) -> Self
Route patch
requests to the given handler. See axum::routing::MethodRouter::patch
for more details.
Sourcepub fn patch_with<T, H, I, D, F>(self, handler: H, transform: F) -> Selfwhere
H: CodecHandler<T, I, D, S> + Clone + Send + Sync + 'static,
I: Input + Send + Sync + 'static,
D: IntoCodecResponse + Send + 'static,
S: Clone + Send + Sync + 'static,
T: Sync + 'static,
F: FnOnce(TransformOperation<'_>) -> TransformOperation<'_>,
pub fn patch_with<T, H, I, D, F>(self, handler: H, transform: F) -> Selfwhere
H: CodecHandler<T, I, D, S> + Clone + Send + Sync + 'static,
I: Input + Send + Sync + 'static,
D: IntoCodecResponse + Send + 'static,
S: Clone + Send + Sync + 'static,
T: Sync + 'static,
F: FnOnce(TransformOperation<'_>) -> TransformOperation<'_>,
Route patch
requests to the given handler. See axum::routing::MethodRouter::patch
for more details.
Sourcepub fn post<T, H, I, D>(self, handler: H) -> Self
pub fn post<T, H, I, D>(self, handler: H) -> Self
Route post
requests to the given handler. See axum::routing::MethodRouter::post
for more details.
Sourcepub fn post_with<T, H, I, D, F>(self, handler: H, transform: F) -> Selfwhere
H: CodecHandler<T, I, D, S> + Clone + Send + Sync + 'static,
I: Input + Send + Sync + 'static,
D: IntoCodecResponse + Send + 'static,
S: Clone + Send + Sync + 'static,
T: Sync + 'static,
F: FnOnce(TransformOperation<'_>) -> TransformOperation<'_>,
pub fn post_with<T, H, I, D, F>(self, handler: H, transform: F) -> Selfwhere
H: CodecHandler<T, I, D, S> + Clone + Send + Sync + 'static,
I: Input + Send + Sync + 'static,
D: IntoCodecResponse + Send + 'static,
S: Clone + Send + Sync + 'static,
T: Sync + 'static,
F: FnOnce(TransformOperation<'_>) -> TransformOperation<'_>,
Route post
requests to the given handler. See axum::routing::MethodRouter::post
for more details.
Sourcepub fn put<T, H, I, D>(self, handler: H) -> Self
pub fn put<T, H, I, D>(self, handler: H) -> Self
Route put
requests to the given handler. See axum::routing::MethodRouter::put
for more details.
Sourcepub fn put_with<T, H, I, D, F>(self, handler: H, transform: F) -> Selfwhere
H: CodecHandler<T, I, D, S> + Clone + Send + Sync + 'static,
I: Input + Send + Sync + 'static,
D: IntoCodecResponse + Send + 'static,
S: Clone + Send + Sync + 'static,
T: Sync + 'static,
F: FnOnce(TransformOperation<'_>) -> TransformOperation<'_>,
pub fn put_with<T, H, I, D, F>(self, handler: H, transform: F) -> Selfwhere
H: CodecHandler<T, I, D, S> + Clone + Send + Sync + 'static,
I: Input + Send + Sync + 'static,
D: IntoCodecResponse + Send + 'static,
S: Clone + Send + Sync + 'static,
T: Sync + 'static,
F: FnOnce(TransformOperation<'_>) -> TransformOperation<'_>,
Route put
requests to the given handler. See axum::routing::MethodRouter::put
for more details.
Sourcepub fn trace<T, H, I, D>(self, handler: H) -> Self
pub fn trace<T, H, I, D>(self, handler: H) -> Self
Route trace
requests to the given handler. See axum::routing::MethodRouter::trace
for more details.
Sourcepub fn trace_with<T, H, I, D, F>(self, handler: H, transform: F) -> Selfwhere
H: CodecHandler<T, I, D, S> + Clone + Send + Sync + 'static,
I: Input + Send + Sync + 'static,
D: IntoCodecResponse + Send + 'static,
S: Clone + Send + Sync + 'static,
T: Sync + 'static,
F: FnOnce(TransformOperation<'_>) -> TransformOperation<'_>,
pub fn trace_with<T, H, I, D, F>(self, handler: H, transform: F) -> Selfwhere
H: CodecHandler<T, I, D, S> + Clone + Send + Sync + 'static,
I: Input + Send + Sync + 'static,
D: IntoCodecResponse + Send + 'static,
S: Clone + Send + Sync + 'static,
T: Sync + 'static,
F: FnOnce(TransformOperation<'_>) -> TransformOperation<'_>,
Route trace
requests to the given handler. See axum::routing::MethodRouter::trace
for more details.