MethodRouter

Struct MethodRouter 

Source
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>
where S: Clone + Send + Sync + 'static,

Source

pub fn delete<T, H, I, D>(self, handler: H) -> Self
where 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,

Route delete requests to the given handler. See axum::routing::MethodRouter::delete for more details.

Source

pub fn delete_with<T, H, I, D, F>(self, handler: H, transform: F) -> Self
where 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.

Source

pub fn get<T, H, I, D>(self, handler: H) -> Self
where 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,

Route get requests to the given handler. See axum::routing::MethodRouter::get for more details.

Source

pub fn get_with<T, H, I, D, F>(self, handler: H, transform: F) -> Self
where 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.

Source

pub fn head<T, H, I, D>(self, handler: H) -> Self
where 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,

Route head requests to the given handler. See axum::routing::MethodRouter::head for more details.

Source

pub fn head_with<T, H, I, D, F>(self, handler: H, transform: F) -> Self
where 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.

Source

pub fn options<T, H, I, D>(self, handler: H) -> Self
where 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,

Route options requests to the given handler. See axum::routing::MethodRouter::options for more details.

Source

pub fn options_with<T, H, I, D, F>(self, handler: H, transform: F) -> Self
where 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.

Source

pub fn patch<T, H, I, D>(self, handler: H) -> Self
where 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,

Route patch requests to the given handler. See axum::routing::MethodRouter::patch for more details.

Source

pub fn patch_with<T, H, I, D, F>(self, handler: H, transform: F) -> Self
where 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.

Source

pub fn post<T, H, I, D>(self, handler: H) -> Self
where 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,

Route post requests to the given handler. See axum::routing::MethodRouter::post for more details.

Source

pub fn post_with<T, H, I, D, F>(self, handler: H, transform: F) -> Self
where 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.

Source

pub fn put<T, H, I, D>(self, handler: H) -> Self
where 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,

Route put requests to the given handler. See axum::routing::MethodRouter::put for more details.

Source

pub fn put_with<T, H, I, D, F>(self, handler: H, transform: F) -> Self
where 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.

Source

pub fn trace<T, H, I, D>(self, handler: H) -> Self
where 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,

Route trace requests to the given handler. See axum::routing::MethodRouter::trace for more details.

Source

pub fn trace_with<T, H, I, D, F>(self, handler: H, transform: F) -> Self
where 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.

Trait Implementations§

Source§

impl<S, E> Clone for MethodRouter<S, E>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S, E> From<ApiMethodRouter<S, E>> for MethodRouter<S, E>

Source§

fn from(router: ApiMethodRouter<S, E>) -> Self

Converts to this type from the input type.
Source§

impl<S, E> From<MethodRouter<S, E>> for ApiMethodRouter<S, E>

Source§

fn from(router: MethodRouter<S, E>) -> Self

Converts to this type from the input type.
Source§

impl<S, E> From<MethodRouter<S, E>> for MethodRouter<S, E>

Source§

fn from(router: MethodRouter<S, E>) -> Self

Converts to this type from the input type.
Source§

impl<S, E> From<MethodRouter<S, E>> for MethodRouter<S, E>

Source§

fn from(router: MethodRouter<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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoApi for T

Source§

fn into_api<A>(self) -> UseApi<T, A>

into UseApi
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,