pub struct WithApi<T>(pub T::Target, pub PhantomData<T>)
where
T: ApiOverride;
Expand description
Allows non OperationInput
or OperationOutput
types to be used in aide handlers with a provided documentation.
For types that already implement OperationInput
or OperationOutput
it overrides the documentation with the provided one.
See ApiOverride
on how to implement such an override
Tuple Fields§
§0: T::Target
§1: PhantomData<T>
Implementations§
source§impl<T> WithApi<T>where
T: ApiOverride,
impl<T> WithApi<T>where
T: ApiOverride,
sourcepub fn into_inner(self) -> T::Target
pub fn into_inner(self) -> T::Target
Unwraps Self into its inner type
Trait Implementations§
source§impl<T> AsMut<<T as ApiOverride>::Target> for WithApi<T>where
T: ApiOverride,
impl<T> AsMut<<T as ApiOverride>::Target> for WithApi<T>where
T: ApiOverride,
source§impl<T> AsRef<<T as ApiOverride>::Target> for WithApi<T>where
T: ApiOverride,
impl<T> AsRef<<T as ApiOverride>::Target> for WithApi<T>where
T: ApiOverride,
source§impl<T> Deref for WithApi<T>where
T: ApiOverride,
impl<T> Deref for WithApi<T>where
T: ApiOverride,
source§impl<T> DerefMut for WithApi<T>where
T: ApiOverride,
impl<T> DerefMut for WithApi<T>where
T: ApiOverride,
source§impl<'de, T> Deserialize<'de> for WithApi<T>
impl<'de, T> Deserialize<'de> for WithApi<T>
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T, S> FromRequest<S> for WithApi<T>
Available on crate feature axum
only.
impl<T, S> FromRequest<S> for WithApi<T>
Available on crate feature
axum
only.§type Rejection = <<T as ApiOverride>::Target as FromRequest<S>>::Rejection
type Rejection = <<T as ApiOverride>::Target as FromRequest<S>>::Rejection
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
source§impl<T, S> FromRequestParts<S> for WithApi<T>
Available on crate feature axum
only.
impl<T, S> FromRequestParts<S> for WithApi<T>
Available on crate feature
axum
only.§type Rejection = <<T as ApiOverride>::Target as FromRequestParts<S>>::Rejection
type Rejection = <<T as ApiOverride>::Target as FromRequestParts<S>>::Rejection
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
source§impl<T> IntoResponse for WithApi<T>
Available on crate feature axum
only.
impl<T> IntoResponse for WithApi<T>
Available on crate feature
axum
only.source§fn into_response(self) -> Response
fn into_response(self) -> Response
Create a response.
source§impl<T> IntoResponseParts for WithApi<T>
Available on crate feature axum
only.
impl<T> IntoResponseParts for WithApi<T>
Available on crate feature
axum
only.§type Error = <<T as ApiOverride>::Target as IntoResponseParts>::Error
type Error = <<T as ApiOverride>::Target as IntoResponseParts>::Error
The type returned in the event of an error. Read more
source§fn into_response_parts(
self,
res: ResponseParts
) -> Result<ResponseParts, Self::Error>
fn into_response_parts( self, res: ResponseParts ) -> Result<ResponseParts, Self::Error>
Set parts of the response
source§impl<T> OperationInput for WithApi<T>where
T: OperationInput + ApiOverride,
impl<T> OperationInput for WithApi<T>where
T: OperationInput + ApiOverride,
source§fn operation_input(ctx: &mut GenContext, operation: &mut Operation)
fn operation_input(ctx: &mut GenContext, operation: &mut Operation)
Modify the operation. Read more
source§fn inferred_early_responses(
ctx: &mut GenContext,
operation: &mut Operation
) -> Vec<(Option<u16>, Response)>
fn inferred_early_responses( ctx: &mut GenContext, operation: &mut Operation ) -> Vec<(Option<u16>, Response)>
Inferred early responses are used to document early returns for
extractors, guards inside handlers. For example these could represent
JSON parsing errors, authentication failures. Read more
source§impl<T> OperationOutput for WithApi<T>where
T: OperationOutput + ApiOverride,
impl<T> OperationOutput for WithApi<T>where
T: OperationOutput + ApiOverride,
§type Inner = <T as OperationOutput>::Inner
type Inner = <T as OperationOutput>::Inner
The type that is used in examples. Read more
source§fn operation_response(
ctx: &mut GenContext,
operation: &mut Operation
) -> Option<Response>
fn operation_response( ctx: &mut GenContext, operation: &mut Operation ) -> Option<Response>
Return a response documentation for this type,
alternatively modify the operation if required. Read more
source§fn inferred_responses(
ctx: &mut GenContext,
operation: &mut Operation
) -> Vec<(Option<u16>, Response)>
fn inferred_responses( ctx: &mut GenContext, operation: &mut Operation ) -> Vec<(Option<u16>, Response)>
Inferred responses are used when the type is
used as a request handler return type. Read more
source§impl<T> Ord for WithApi<T>
impl<T> Ord for WithApi<T>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<T> PartialEq for WithApi<T>
impl<T> PartialEq for WithApi<T>
source§impl<T> PartialOrd for WithApi<T>
impl<T> PartialOrd for WithApi<T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<T> Copy for WithApi<T>
impl<T> Eq for WithApi<T>
impl<T> StructuralPartialEq for WithApi<T>where
T: ApiOverride,
Auto Trait Implementations§
impl<T> Freeze for WithApi<T>
impl<T> RefUnwindSafe for WithApi<T>
impl<T> Send for WithApi<T>
impl<T> Sync for WithApi<T>
impl<T> Unpin for WithApi<T>
impl<T> UnwindSafe for WithApi<T>
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<S, T> FromRequest<S, ViaParts> for T
impl<S, T> FromRequest<S, ViaParts> for T
§type Rejection = <T as FromRequestParts<S>>::Rejection
type Rejection = <T as FromRequestParts<S>>::Rejection
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
source§impl<T, S> Handler<IntoResponseHandler, S> for T
impl<T, S> Handler<IntoResponseHandler, S> for T
source§fn call(
self,
_req: Request<Body>,
_state: S
) -> <T as Handler<IntoResponseHandler, S>>::Future
fn call( self, _req: Request<Body>, _state: S ) -> <T as Handler<IntoResponseHandler, S>>::Future
Call the handler with the given request.
source§fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
Apply a
tower::Layer
to the handler. Read moresource§fn with_state(self, state: S) -> HandlerService<Self, T, S>
fn with_state(self, state: S) -> HandlerService<Self, T, S>
Convert the handler into a
Service
by providing the statesource§impl<H, T> HandlerWithoutStateExt<T> for H
impl<H, T> HandlerWithoutStateExt<T> for H
source§fn into_service(self) -> HandlerService<H, T, ()>
fn into_service(self) -> HandlerService<H, T, ()>
Convert the handler into a
Service
and no state.source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
Convert the handler into a
MakeService
and no state. Read moresource§fn into_make_service_with_connect_info<C>(
self
) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
fn into_make_service_with_connect_info<C>( self ) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
Available on crate feature
tokio
only.Convert the handler into a
MakeService
which stores information
about the incoming connection and has no state. Read more