pub enum ServiceProviderContext {
Root(Arc<ServiceProvider>),
Scoped(Arc<ScopedServiceProvider>),
}Expand description
Context passed to service factories to enable dependency resolution.
This enum represents either a root provider or a scoped provider, allowing factories to resolve dependencies from the appropriate context.
Variants§
Root(Arc<ServiceProvider>)
Root service provider context.
Scoped(Arc<ScopedServiceProvider>)
Scoped service provider context.
Implementations§
Source§impl ServiceProviderContext
impl ServiceProviderContext
Sourcepub async fn get<T: Send + Sync + 'static>(
&self,
) -> Result<Arc<T>, ServiceError>
pub async fn get<T: Send + Sync + 'static>( &self, ) -> Result<Arc<T>, ServiceError>
Resolves a service from the current context.
§Errors
Returns a ServiceError if the service cannot be resolved.
Trait Implementations§
Source§impl Clone for ServiceProviderContext
impl Clone for ServiceProviderContext
Source§fn clone(&self) -> ServiceProviderContext
fn clone(&self) -> ServiceProviderContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ServiceProviderContext
impl !RefUnwindSafe for ServiceProviderContext
impl Send for ServiceProviderContext
impl Sync for ServiceProviderContext
impl Unpin for ServiceProviderContext
impl !UnwindSafe for ServiceProviderContext
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