caelix_core/controller.rs
1use std::any::Any;
2
3#[derive(Clone, Copy, Debug, Eq, PartialEq)]
4pub struct RouteDef {
5 pub method: &'static str,
6 pub path: &'static str,
7 pub handler: &'static str,
8}
9
10pub trait Controller {
11 fn base_path() -> &'static str;
12 fn routes() -> &'static [RouteDef] {
13 &[]
14 }
15 fn register_routes(cfg: &mut dyn Any);
16
17 #[cfg(feature = "openapi")]
18 #[doc(hidden)]
19 fn openapi_routes() -> &'static [crate::openapi::OpenApiRouteDef] {
20 &[]
21 }
22}