pub struct ServiceCollection { /* private fields */ }Implementations§
Source§impl ServiceCollection
impl ServiceCollection
pub fn new() -> Self
pub fn singleton<T: ?Sized + Send + Sync + 'static>( self, f: impl Fn(&dyn IServiceResolver) -> Arc<T> + Send + Sync + 'static, ) -> Self
pub fn transient<T: ?Sized + Send + Sync + 'static>( self, f: impl Fn(&dyn IServiceResolver) -> Arc<T> + Send + Sync + 'static, ) -> Self
pub fn scoped<T: ?Sized + Send + Sync + 'static>( self, f: impl Fn(&dyn IServiceResolver) -> Arc<T> + Send + Sync + 'static, ) -> Self
pub fn keyed<T: ?Sized + Send + Sync + 'static>( self, k: impl Into<String>, f: impl Fn(&dyn IServiceResolver) -> Arc<T> + Send + Sync + 'static, ) -> Self
pub fn keyed_transient<T: ?Sized + Send + Sync + 'static>( self, k: impl Into<String>, f: impl Fn(&dyn IServiceResolver) -> Arc<T> + Send + Sync + 'static, ) -> Self
pub fn keyed_scoped<T: ?Sized + Send + Sync + 'static>( self, k: impl Into<String>, f: impl Fn(&dyn IServiceResolver) -> Arc<T> + Send + Sync + 'static, ) -> Self
pub fn try_add<T: ?Sized + Send + Sync + 'static>( self, f: impl Fn(&dyn IServiceResolver) -> Arc<T> + Send + Sync + 'static, ) -> Self
pub fn add<T: ?Sized + Send + Sync + 'static>( self, lt: ServiceLifetime, f: impl Fn(&dyn IServiceResolver) -> Arc<T> + Send + Sync + 'static, ) -> Self
pub fn instance<T: Send + Sync + 'static>(self, v: Arc<T>) -> Self
pub fn singleton_value<T: Send + Sync + 'static>(self, v: T) -> Self
pub fn build(self) -> Result<ServiceProvider, RdiError>
Sourcepub fn from_injected() -> Self
pub fn from_injected() -> Self
Build a ServiceCollection from all #[rust_dicore::inject] annotations
in the current binary (across all crates).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ServiceCollection
impl !UnwindSafe for ServiceCollection
impl Freeze for ServiceCollection
impl Send for ServiceCollection
impl Sync for ServiceCollection
impl Unpin for ServiceCollection
impl UnsafeUnpin for ServiceCollection
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