pub struct ApiRouter { /* private fields */ }Implementations§
Source§impl ApiRouter
impl ApiRouter
pub fn new(title: &str, version: &str) -> Self
pub fn route(self, path: &str, method_router: MethodRouter) -> Self
pub fn get<H, T>(self, path: &str, handler: H) -> Self
pub fn post<H, T>(self, path: &str, handler: H) -> Self
pub fn put<H, T>(self, path: &str, handler: H) -> Self
pub fn delete<H, T>(self, path: &str, handler: H) -> Self
pub fn patch<H, T>(self, path: &str, handler: H) -> Self
pub fn openapi_spec(&self) -> &OpenAPI
Sourcepub fn description(self, description: &str) -> Self
pub fn description(self, description: &str) -> Self
Set the API description
Sourcepub fn terms_of_service(self, terms_of_service: &str) -> Self
pub fn terms_of_service(self, terms_of_service: &str) -> Self
Set the terms of service URL
Sourcepub fn contact(
self,
name: Option<&str>,
url: Option<&str>,
email: Option<&str>,
) -> Self
pub fn contact( self, name: Option<&str>, url: Option<&str>, email: Option<&str>, ) -> Self
Set contact information
Sourcepub fn contact_email(self, email: &str) -> Self
pub fn contact_email(self, email: &str) -> Self
Set contact email only
Sourcepub fn tag_with_docs(
self,
name: &str,
description: Option<&str>,
docs_description: Option<&str>,
docs_url: &str,
) -> Self
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
pub fn openapi_json(&mut self) -> String
Sourcepub fn get_unused_schemas(&mut self) -> Vec<String>
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)
Sourcepub fn get_unused_schemas_current(&self) -> Vec<String>
pub fn get_unused_schemas_current(&self) -> Vec<String>
Get unused schemas without triggering OpenAPI generation (for testing)
Sourcepub fn warn_unused_schemas(&mut self)
pub fn warn_unused_schemas(&mut self)
Print warnings for unused schemas
pub fn with_openapi_routes(self) -> Self
pub fn with_openapi_routes_prefix(self, prefix: &str) -> Self
pub fn into_router(self) -> Router
Auto Trait Implementations§
impl Freeze for ApiRouter
impl !RefUnwindSafe for ApiRouter
impl Send for ApiRouter
impl Sync for ApiRouter
impl Unpin for ApiRouter
impl !UnwindSafe for ApiRouter
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