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.Source§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.Source§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.Source§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,
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> PartialOrd for WithApi<T>
impl<T> PartialOrd for WithApi<T>
impl<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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
Source§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§async fn from_request(
req: Request<Body>,
state: &S,
) -> Result<T, <T as FromRequest<S, ViaParts>>::Rejection>
async fn from_request( req: Request<Body>, state: &S, ) -> Result<T, <T as FromRequest<S, ViaParts>>::Rejection>
Perform the extraction.
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