Struct dropshot::ApiDescription [−][src]
An ApiDescription represents the endpoints and handler functions in your API. Other metadata could also be provided here. This object can be used to generate an OpenAPI spec or to run an HTTP server implementing the API.
Implementations
impl ApiDescription
[src]
pub fn new() -> Self
[src]
pub fn register<T>(&mut self, endpoint: T) -> Result<(), String> where
T: Into<ApiEndpoint>,
[src]
T: Into<ApiEndpoint>,
Register a new API endpoint.
pub fn openapi<S1, S2>(&self, title: S1, version: S2) -> OpenApiDefinition<'_> where
S1: AsRef<str>,
S2: AsRef<str>,
[src]
S1: AsRef<str>,
S2: AsRef<str>,
Build the OpenAPI definition describing this API. Returns an
OpenApiDefinition
which can be used to specify the contents of the
definition and select an output format.
The arguments to this function will be used for the mandatory title
and
version
properties that the Info
object in an OpenAPI definition must
contain.
pub fn print_openapi(
&self,
out: &mut dyn Write,
title: &dyn ToString,
description: Option<&dyn ToString>,
terms_of_service: Option<&dyn ToString>,
contact_name: Option<&dyn ToString>,
contact_url: Option<&dyn ToString>,
contact_email: Option<&dyn ToString>,
license_name: Option<&dyn ToString>,
license_url: Option<&dyn ToString>,
version: &dyn ToString
) -> Result<()>
[src]
&self,
out: &mut dyn Write,
title: &dyn ToString,
description: Option<&dyn ToString>,
terms_of_service: Option<&dyn ToString>,
contact_name: Option<&dyn ToString>,
contact_url: Option<&dyn ToString>,
contact_email: Option<&dyn ToString>,
license_name: Option<&dyn ToString>,
license_url: Option<&dyn ToString>,
version: &dyn ToString
) -> Result<()>
switch to openapi()
Emit the OpenAPI Spec document describing this API in its JSON form.
This routine is deprecated in favour of the new openapi() builder routine.
pub fn into_router(self) -> HttpRouter
[src]
Auto Trait Implementations
impl !RefUnwindSafe for ApiDescription
[src]
impl Send for ApiDescription
[src]
impl Sync for ApiDescription
[src]
impl Unpin for ApiDescription
[src]
impl !UnwindSafe for ApiDescription
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,