Struct poem_openapi::OpenApiService
source · [−]pub struct OpenApiService<T, W: ?Sized> { /* private fields */ }
Expand description
An OpenAPI service for Poem.
Implementations
sourceimpl<T> OpenApiService<T, ()>
impl<T> OpenApiService<T, ()>
sourceimpl<T, W: ?Sized> OpenApiService<T, W>
impl<T, W: ?Sized> OpenApiService<T, W>
sourcepub fn webhooks<W2: ?Sized>(self) -> OpenApiService<T, W2>
pub fn webhooks<W2: ?Sized>(self) -> OpenApiService<T, W2>
Sets the webhooks.
sourcepub fn summary(self, summary: impl Into<String>) -> Self
pub fn summary(self, summary: impl Into<String>) -> Self
Sets the summary of the API container.
sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Sets the description of the API container.
sourcepub fn terms_of_service(self, url: impl Into<String>) -> Self
pub fn terms_of_service(self, url: impl Into<String>) -> Self
Sets a URL to the Terms of Service for the API.
sourcepub fn server(self, server: impl Into<ServerObject>) -> Self
pub fn server(self, server: impl Into<ServerObject>) -> Self
Appends a server to the API container.
Reference: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverObject
sourcepub fn license(self, license: impl Into<LicenseObject>) -> Self
pub fn license(self, license: impl Into<LicenseObject>) -> Self
Sets the license information for the exposed API.
Reference: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#license-object
sourcepub fn external_document(
self,
external_document: impl Into<ExternalDocumentObject>
) -> Self
pub fn external_document(
self,
external_document: impl Into<ExternalDocumentObject>
) -> Self
Add a external document object.
Sets the cookie key.
sourcepub fn swagger_ui(&self) -> impl Endpoint where
T: OpenApi,
W: Webhook,
pub fn swagger_ui(&self) -> impl Endpoint where
T: OpenApi,
W: Webhook,
Create the Swagger UI endpoint.
sourcepub fn rapidoc(&self) -> impl Endpoint where
T: OpenApi,
W: Webhook,
pub fn rapidoc(&self) -> impl Endpoint where
T: OpenApi,
W: Webhook,
Create the Rapidoc endpoint.
sourcepub fn spec_endpoint(&self) -> impl Endpoint where
T: OpenApi,
W: Webhook,
pub fn spec_endpoint(&self) -> impl Endpoint where
T: OpenApi,
W: Webhook,
Create an endpoint to serve the open api specification.
Trait Implementations
sourceimpl<T: OpenApi, W: Webhook> IntoEndpoint for OpenApiService<T, W>
impl<T: OpenApi, W: Webhook> IntoEndpoint for OpenApiService<T, W>
type Endpoint = BoxEndpoint<'static>
type Endpoint = BoxEndpoint<'static>
Represents the endpoint type.
sourcefn into_endpoint(self) -> Self::Endpoint
fn into_endpoint(self) -> Self::Endpoint
Converts this object into endpoint.
Auto Trait Implementations
impl<T, W: ?Sized> RefUnwindSafe for OpenApiService<T, W> where
T: RefUnwindSafe,
W: RefUnwindSafe,
impl<T, W: ?Sized> Send for OpenApiService<T, W> where
T: Send,
W: Send,
impl<T, W: ?Sized> Sync for OpenApiService<T, W> where
T: Sync,
W: Sync,
impl<T, W: ?Sized> Unpin for OpenApiService<T, W> where
T: Unpin,
W: Unpin,
impl<T, W: ?Sized> UnwindSafe for OpenApiService<T, W> where
T: UnwindSafe,
W: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> EndpointExt for T where
T: IntoEndpoint,
impl<T> EndpointExt for T where
T: IntoEndpoint,
sourcefn boxed<'a>(
self
) -> Box<dyn Endpoint<Output = <Self::Endpoint as Endpoint>::Output> + 'a, Global> where
Self: 'a,
fn boxed<'a>(
self
) -> Box<dyn Endpoint<Output = <Self::Endpoint as Endpoint>::Output> + 'a, Global> where
Self: 'a,
Wrap the endpoint in a Box.
sourcefn with<T>(self, middleware: T) -> <T as Middleware<Self::Endpoint>>::Output where
T: Middleware<Self::Endpoint>,
fn with<T>(self, middleware: T) -> <T as Middleware<Self::Endpoint>>::Output where
T: Middleware<Self::Endpoint>,
Use middleware to transform this endpoint. Read more
sourcefn with_if<T>(
self,
enable: bool,
middleware: T
) -> EitherEndpoint<Self, <T as Middleware<Self::Endpoint>>::Output> where
T: Middleware<Self::Endpoint>,
fn with_if<T>(
self,
enable: bool,
middleware: T
) -> EitherEndpoint<Self, <T as Middleware<Self::Endpoint>>::Output> where
T: Middleware<Self::Endpoint>,
if enable
is true
then use middleware to transform this endpoint. Read more
sourcefn data<T>(self, data: T) -> AddDataEndpoint<Self::Endpoint, T> where
T: 'static + Clone + Send + Sync,
fn data<T>(self, data: T) -> AddDataEndpoint<Self::Endpoint, T> where
T: 'static + Clone + Send + Sync,
A helper function, similar to with(AddData(T))
. Read more
sourcefn before<F, Fut>(self, f: F) -> Before<Self, F> where
F: Fn(Request) -> Fut + Send + Sync,
Fut: Future<Output = Result<Request, Error>> + Send,
fn before<F, Fut>(self, f: F) -> Before<Self, F> where
F: Fn(Request) -> Fut + Send + Sync,
Fut: Future<Output = Result<Request, Error>> + Send,
Maps the request of this endpoint. Read more
sourcefn after<F, Fut, T>(self, f: F) -> After<Self::Endpoint, F> where
F: Fn(Result<<Self::Endpoint as Endpoint>::Output, Error>) -> Fut + Send + Sync,
Fut: Future<Output = Result<T, Error>> + Send,
T: IntoResponse,
fn after<F, Fut, T>(self, f: F) -> After<Self::Endpoint, F> where
F: Fn(Result<<Self::Endpoint as Endpoint>::Output, Error>) -> Fut + Send + Sync,
Fut: Future<Output = Result<T, Error>> + Send,
T: IntoResponse,
Maps the output of this endpoint. Read more
sourcefn around<F, Fut, R>(self, f: F) -> Around<Self::Endpoint, F> where
F: 'static + Fn(Arc<Self::Endpoint>, Request) -> Fut + Send + Sync,
Fut: 'static + Future<Output = Result<R, Error>> + Send,
R: IntoResponse,
fn around<F, Fut, R>(self, f: F) -> Around<Self::Endpoint, F> where
F: 'static + Fn(Arc<Self::Endpoint>, Request) -> Fut + Send + Sync,
Fut: 'static + Future<Output = Result<R, Error>> + Send,
R: IntoResponse,
Maps the request and response of this endpoint. Read more
sourcefn map_to_response(self) -> MapToResponse<Self::Endpoint>
fn map_to_response(self) -> MapToResponse<Self::Endpoint>
sourcefn to_response(self) -> ToResponse<Self::Endpoint>
fn to_response(self) -> ToResponse<Self::Endpoint>
sourcefn map<F, Fut, R, R2>(self, f: F) -> Map<Self::Endpoint, F> where
F: Fn(R) -> Fut + Send + Sync,
Fut: Future<Output = R2> + Send,
R: IntoResponse,
R2: IntoResponse,
Self::Endpoint: Endpoint,
Self::Endpoint: Sized,
<Self::Endpoint as Endpoint>::Output == R,
fn map<F, Fut, R, R2>(self, f: F) -> Map<Self::Endpoint, F> where
F: Fn(R) -> Fut + Send + Sync,
Fut: Future<Output = R2> + Send,
R: IntoResponse,
R2: IntoResponse,
Self::Endpoint: Endpoint,
Self::Endpoint: Sized,
<Self::Endpoint as Endpoint>::Output == R,
Maps the response of this endpoint. Read more
sourcefn and_then<F, Fut, R, R2>(self, f: F) -> AndThen<Self::Endpoint, F> where
F: Fn(R) -> Fut + Send + Sync,
Fut: Future<Output = Result<R2, Error>> + Send,
R: IntoResponse,
R2: IntoResponse,
Self::Endpoint: Endpoint,
Self::Endpoint: Sized,
<Self::Endpoint as Endpoint>::Output == R,
fn and_then<F, Fut, R, R2>(self, f: F) -> AndThen<Self::Endpoint, F> where
F: Fn(R) -> Fut + Send + Sync,
Fut: Future<Output = Result<R2, Error>> + Send,
R: IntoResponse,
R2: IntoResponse,
Self::Endpoint: Endpoint,
Self::Endpoint: Sized,
<Self::Endpoint as Endpoint>::Output == R,
Calls f
if the result is Ok
, otherwise returns the Err
value of
self. Read more
sourcefn catch_all_error<F, Fut, R>(self, f: F) -> CatchAllError<Self, F, R> where
F: Fn(Error) -> Fut + Send + Sync,
Fut: Future<Output = R> + Send,
R: IntoResponse + Send,
Self: Sync,
fn catch_all_error<F, Fut, R>(self, f: F) -> CatchAllError<Self, F, R> where
F: Fn(Error) -> Fut + Send + Sync,
Fut: Future<Output = R> + Send,
R: IntoResponse + Send,
Self: Sync,
Catch the all errors and convert it into a response. Read more
sourcefn catch_error<F, Fut, R, ErrType>(
self,
f: F
) -> CatchError<Self, F, R, ErrType> where
F: Fn(ErrType) -> Fut + Send + Sync,
Fut: Future<Output = R> + Send,
R: IntoResponse + Send + Sync,
ErrType: 'static + Error + Send + Sync,
fn catch_error<F, Fut, R, ErrType>(
self,
f: F
) -> CatchError<Self, F, R, ErrType> where
F: Fn(ErrType) -> Fut + Send + Sync,
Fut: Future<Output = R> + Send,
R: IntoResponse + Send + Sync,
ErrType: 'static + Error + Send + Sync,
Catch the specified type of error and convert it into a response. Read more
sourcefn inspect_all_err<F>(self, f: F) -> InspectAllError<Self, F> where
F: Fn(&Error) + Send + Sync,
fn inspect_all_err<F>(self, f: F) -> InspectAllError<Self, F> where
F: Fn(&Error) + Send + Sync,
Does something with each error. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more