pub struct Registry { /* private fields */ }
Expand description
Component registry for dependency injection and service location
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn builder() -> RegistryBuilder
pub fn builder() -> RegistryBuilder
Create a registry builder
Sourcepub fn register<T>(
&self,
name: impl Into<String>,
component: T,
) -> Result<(), RegistryError>
pub fn register<T>( &self, name: impl Into<String>, component: T, ) -> Result<(), RegistryError>
Register a component with the given name
Sourcepub fn get<T>(&self, name: &str) -> Result<Arc<T>, RegistryError>
pub fn get<T>(&self, name: &str) -> Result<Arc<T>, RegistryError>
Get a component by name and type
Sourcepub fn component_names(&self) -> Vec<String>
pub fn component_names(&self) -> Vec<String>
Get all registered component names
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Registry
impl !RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl !UnwindSafe for Registry
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