pub trait ElifController:
Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> &str;
fn base_path(&self) -> &str;
fn routes(&self) -> Vec<ControllerRoute>;
fn handle_request<'async_trait>(
self: Arc<Self>,
method_name: String,
request: ElifRequest,
) -> Pin<Box<dyn Future<Output = HttpResult<ElifResponse>> + Send + 'async_trait>>
where Self: 'async_trait;
// Provided methods
fn dependencies(&self) -> Vec<String> { ... }
fn handle_request_dyn<'life0, 'async_trait>(
&'life0 self,
method_name: String,
request: ElifRequest,
) -> Pin<Box<dyn Future<Output = HttpResult<ElifResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
Main trait for controllers with automatic route registration
Required Methods§
Sourcefn routes(&self) -> Vec<ControllerRoute>
fn routes(&self) -> Vec<ControllerRoute>
Route definitions for this controller
Sourcefn handle_request<'async_trait>(
self: Arc<Self>,
method_name: String,
request: ElifRequest,
) -> Pin<Box<dyn Future<Output = HttpResult<ElifResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
fn handle_request<'async_trait>(
self: Arc<Self>,
method_name: String,
request: ElifRequest,
) -> Pin<Box<dyn Future<Output = HttpResult<ElifResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
Handle a request by dispatching to the appropriate method
Uses Arc
Provided Methods§
Sourcefn dependencies(&self) -> Vec<String>
fn dependencies(&self) -> Vec<String>
Dependencies required by this controller (optional)
Sourcefn handle_request_dyn<'life0, 'async_trait>(
&'life0 self,
method_name: String,
request: ElifRequest,
) -> Pin<Box<dyn Future<Output = HttpResult<ElifResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_request_dyn<'life0, 'async_trait>(
&'life0 self,
method_name: String,
request: ElifRequest,
) -> Pin<Box<dyn Future<Output = HttpResult<ElifResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dynamic dispatch method for trait objects This method allows calling controller methods through trait objects by providing a default implementation that performs reflection-like dispatch