pub struct RouterAndDocs {
pub router: Router<AppState>,
pub docs: OpenApi,
}Expand description
Encapsulates both an axum router and a set of OpenApi docs. Use the router_with_docs! macro to create one of these.
Fields§
§router: Router<AppState>§docs: OpenApiImplementations§
Source§impl RouterAndDocs
impl RouterAndDocs
Sourcepub fn register<T, H>(&mut self, api: OpenApi, handler: H)where
T: 'static,
H: 'static + Handler<T, AppState>,
pub fn register<T, H>(&mut self, api: OpenApi, handler: H)where
T: 'static,
H: 'static + Handler<T, AppState>,
Register a route based on the definition contained in the provided
OpenApi docs. This will extract the path and correct operation
type from the openapi docs and use that to register the handler,
allowing the path and operation for the handler to be centrally
defined in the utoipa::path macro annotation on the handler
itself.
You will not call this directly: it will be called via the
router_with_docs! macro invocation.
The OpenApi instance MUST have only a single path with a single operation defined within it. This is upheld in the macro implementation.
Auto Trait Implementations§
impl Freeze for RouterAndDocs
impl !RefUnwindSafe for RouterAndDocs
impl Send for RouterAndDocs
impl Sync for RouterAndDocs
impl Unpin for RouterAndDocs
impl !UnwindSafe for RouterAndDocs
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more