pub struct ServiceProvider { /* private fields */ }Expand description
The root of a built container. Cheap to clone.
Implementations§
Source§impl ServiceProvider
impl ServiceProvider
Sourcepub fn resolve<T: ?Sized + Send + Sync + 'static>(
&self,
) -> Result<Arc<T>, ResolveError>
pub fn resolve<T: ?Sized + Send + Sync + 'static>( &self, ) -> Result<Arc<T>, ResolveError>
Resolves a singleton or transient service.
When T is registered more than once, the last registration wins; use
resolve_all for every one.
Sourcepub fn resolve_all<T: ?Sized + Send + Sync + 'static>(
&self,
) -> Result<Vec<Arc<T>>, ResolveError>
pub fn resolve_all<T: ?Sized + Send + Sync + 'static>( &self, ) -> Result<Vec<Arc<T>>, ResolveError>
Resolves every registration of T, in registration order.
Sourcepub fn create_scope(&self) -> Scope
pub fn create_scope(&self) -> Scope
Creates a scope for resolving scoped services.
Trait Implementations§
Source§impl Clone for ServiceProvider
impl Clone for ServiceProvider
Auto Trait Implementations§
impl !RefUnwindSafe for ServiceProvider
impl !UnwindSafe for ServiceProvider
impl Freeze for ServiceProvider
impl Send for ServiceProvider
impl Sync for ServiceProvider
impl Unpin for ServiceProvider
impl UnsafeUnpin for ServiceProvider
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