pub trait RouteController: Send + Sync {
// Required methods
fn base_path(&self) -> &str;
fn register_routes<'life0, 'life1, 'async_trait>(
&'life0 self,
router: &'life1 mut Router,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn version(&self) -> u32 { ... }
fn full_path(&self, path: &str) -> String { ... }
fn register<'life0, 'life1, 'async_trait>(
&'life0 self,
router: &'life1 mut Router,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn type_name(&self) -> &'static str { ... }
}Expand description
Groups related routes under a shared base path and version.
Implement RouteController::base_path and RouteController::register_routes;
override RouteController::version to prefix paths with /v{version}.
Required Methods§
Sourcefn register_routes<'life0, 'life1, 'async_trait>(
&'life0 self,
router: &'life1 mut Router,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn register_routes<'life0, 'life1, 'async_trait>(
&'life0 self,
router: &'life1 mut Router,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Registers this controller’s routes on router, typically via RouteControllerExt.
Provided Methods§
Sourcefn full_path(&self, path: &str) -> String
fn full_path(&self, path: &str) -> String
Resolves a relative path to its full mounted path including base path and version.
Sourcefn register<'life0, 'life1, 'async_trait>(
&'life0 self,
router: &'life1 mut Router,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn register<'life0, 'life1, 'async_trait>(
&'life0 self,
router: &'life1 mut Router,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Default registration entry point; delegates to RouteController::register_routes.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".