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§fn from_request(
req: Request<Body>,
state: &S,
) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>
fn from_request( req: Request<Body>, state: &S, ) -> impl Future<Output = 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>
Convert the handler into a
MakeService which stores information
about the incoming connection and has no state. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<R> Rng for R
impl<R> Rng for R
Source§fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
Return a random value via the
StandardUniform distribution. Read moreSource§fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
Source§fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Generate a random value in the given range. Read more
Source§fn random_bool(&mut self, p: f64) -> bool
fn random_bool(&mut self, p: f64) -> bool
Return a bool with a probability
p of being true. Read moreSource§fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
Return a bool with a probability of
numerator/denominator of being
true. Read moreSource§fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
Sample a new value, using the given distribution. Read more
Source§fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
Create an iterator that generates values using the given distribution. Read more
Source§fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
👎Deprecated since 0.9.0: Renamed to
random to avoid conflict with the new gen keyword in Rust 2024.Alias for
Rng::random.Source§fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
👎Deprecated since 0.9.0: Renamed to
random_rangeAlias for
Rng::random_range.Source§impl<R> TryRngCore for R
impl<R> TryRngCore for R
Source§type Error = Infallible
type Error = Infallible
The type returned in the event of a RNG error.
Source§fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
Return the next random
u32.Source§fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
Return the next random
u64.Source§fn try_fill_bytes(
&mut self,
dst: &mut [u8],
) -> Result<(), <R as TryRngCore>::Error>
fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>
Fill
dest entirely with random data.Source§fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
Wrap RNG with the
UnwrapMut wrapper.Source§fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
Convert an
RngCore to a RngReadAdapter.