Struct dropshot::ApiDescription[][src]

pub struct ApiDescription { /* fields omitted */ }

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]

Register a new API endpoint.

pub fn openapi<S1, S2>(&self, title: S1, version: S2) -> OpenApiDefinition<'_> where
    S1: AsRef<str>,
    S2: AsRef<str>, 
[src]

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]

👎 Deprecated:

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.