use openapiv3::Responses;
use crate::handler_argument::HandlerArgumentFns;
use crate::internals::HttpMethod;
use crate::internals::SchemaGenerator;
#[derive(Copy, Clone, Debug)]
pub struct SwaggapiHandler {
pub method: HttpMethod,
pub path: &'static str,
pub deprecated: bool,
pub doc: &'static [&'static str],
pub ident: &'static str,
pub tags: &'static [&'static str],
pub responses: fn(&mut SchemaGenerator) -> Responses,
pub handler_arguments: &'static [Option<HandlerArgumentFns>],
#[cfg(feature = "actix")]
pub actix: fn() -> actix_web::Route,
#[cfg(not(feature = "actix"))]
pub actix: (),
#[cfg(feature = "axum")]
pub axum: fn() -> ::axum::routing::MethodRouter,
#[cfg(not(feature = "axum"))]
pub axum: (),
}
#[cfg(not(feature = "actix"))]
#[macro_export]
#[doc(hidden)]
macro_rules! impl_Foo_actix {
($method:expr, $ident:ident) => {
()
};
}
#[cfg(feature = "actix")]
#[macro_export]
#[doc(hidden)]
macro_rules! impl_Foo_actix {
($method:expr, $ident:ident) => {
|| {
$crate::re_exports::actix_web::Route::new()
.method($method.actix())
.to($ident)
}
};
}
#[cfg(not(feature = "axum"))]
#[macro_export]
#[doc(hidden)]
macro_rules! impl_Foo_axum {
($method:expr, $ident:ident) => {
()
};
}
#[cfg(feature = "axum")]
#[macro_export]
#[doc(hidden)]
macro_rules! impl_Foo_axum {
($method:expr, $ident:ident) => {
|| $crate::re_exports::axum::routing::MethodRouter::new().on($method.axum(), $ident)
};
}