ApiRouter

Struct ApiRouter 

Source
pub struct ApiRouter { /* private fields */ }

Implementations§

Source§

impl ApiRouter

Source

pub fn new(title: &str, version: &str) -> Self

Source

pub fn route(self, path: &str, method_router: MethodRouter) -> Self

Source

pub fn get<H, T>(self, path: &str, handler: H) -> Self
where H: Handler<T, ()>, T: 'static,

Source

pub fn post<H, T>(self, path: &str, handler: H) -> Self
where H: Handler<T, ()>, T: 'static,

Source

pub fn put<H, T>(self, path: &str, handler: H) -> Self
where H: Handler<T, ()>, T: 'static,

Source

pub fn delete<H, T>(self, path: &str, handler: H) -> Self
where H: Handler<T, ()>, T: 'static,

Source

pub fn patch<H, T>(self, path: &str, handler: H) -> Self
where H: Handler<T, ()>, T: 'static,

Source

pub fn openapi_spec(&self) -> &OpenAPI

Source

pub fn description(self, description: &str) -> Self

Set the API description

Source

pub fn terms_of_service(self, terms_of_service: &str) -> Self

Set the terms of service URL

Source

pub fn contact( self, name: Option<&str>, url: Option<&str>, email: Option<&str>, ) -> Self

Set contact information

Source

pub fn contact_email(self, email: &str) -> Self

Set contact email only

Source

pub fn license(self, name: &str, url: Option<&str>) -> Self

Set license information

Source

pub fn tag(self, name: &str, description: Option<&str>) -> Self

Add a tag definition

Source

pub fn tag_with_docs( self, name: &str, description: Option<&str>, docs_description: Option<&str>, docs_url: &str, ) -> Self

Add a tag with external documentation

Source

pub fn openapi_json(&mut self) -> String

Source

pub fn get_unused_schemas(&mut self) -> Vec<String>

Get a list of unused schemas (schemas that are registered but not referenced in any endpoint)

Source

pub fn get_unused_schemas_current(&self) -> Vec<String>

Get unused schemas without triggering OpenAPI generation (for testing)

Source

pub fn warn_unused_schemas(&mut self)

Print warnings for unused schemas

Source

pub fn with_openapi_routes(self) -> Self

Source

pub fn with_openapi_routes_prefix(self, prefix: &str) -> Self

Source

pub fn into_router(self) -> Router

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<'de, T> Deserialize<'de> for T

Source§

impl<T> Serialize for T