caelix_core/
controller.rs1use std::any::Any;
2
3use crate::ProviderDependency;
4
5#[derive(Clone, Copy, Debug, Eq, PartialEq)]
6pub struct RouteDef {
8 pub method: &'static str,
10 pub path: &'static str,
12 pub handler: &'static str,
14}
15
16pub trait Controller {
18 fn base_path() -> &'static str;
20
21 fn route_dependencies() -> Vec<ProviderDependency> {
25 vec![]
26 }
27
28 fn routes() -> &'static [RouteDef] {
30 &[]
31 }
32 fn register_routes(cfg: &mut dyn Any);
34
35 #[cfg(feature = "openapi")]
36 #[doc(hidden)]
37 fn openapi_routes() -> &'static [crate::openapi::OpenApiRouteDef] {
38 &[]
39 }
40}