pub struct ControllerRegistry { /* private fields */ }
Expand description
Controller registry for managing controller factories
Implementations§
Source§impl ControllerRegistry
impl ControllerRegistry
Sourcepub fn new(container: Arc<IocContainer>) -> Self
pub fn new(container: Arc<IocContainer>) -> Self
Create a new controller registry with IoC container
Sourcepub fn register<T>(&mut self, name: &str) -> Result<(), HttpError>where
T: ElifController + IocControllable + 'static,
pub fn register<T>(&mut self, name: &str) -> Result<(), HttpError>where
T: ElifController + IocControllable + 'static,
Register a controller type with automatic factory creation
Sourcepub fn register_factory(
&mut self,
name: &str,
factory: Box<dyn ControllerFactory>,
)
pub fn register_factory( &mut self, name: &str, factory: Box<dyn ControllerFactory>, )
Register a custom factory for a controller
Sourcepub async fn create_controller(
&self,
name: &str,
scope: Option<&ScopeId>,
) -> Result<Arc<dyn ElifController>, HttpError>
pub async fn create_controller( &self, name: &str, scope: Option<&ScopeId>, ) -> Result<Arc<dyn ElifController>, HttpError>
Create a controller instance by name
Sourcepub async fn create_scoped_registry(
&self,
request: &ElifRequest,
) -> Result<ScopedControllerRegistry<'_>, HttpError>
pub async fn create_scoped_registry( &self, request: &ElifRequest, ) -> Result<ScopedControllerRegistry<'_>, HttpError>
Create a scoped controller registry for request-specific controllers
Sourcepub fn registered_controllers(&self) -> Vec<String>
pub fn registered_controllers(&self) -> Vec<String>
Get list of registered controller names
Auto Trait Implementations§
impl Freeze for ControllerRegistry
impl !RefUnwindSafe for ControllerRegistry
impl Send for ControllerRegistry
impl Sync for ControllerRegistry
impl Unpin for ControllerRegistry
impl !UnwindSafe for ControllerRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more