pub struct ServiceProvider { /* private fields */ }Expand description
Cloneable handle to a root provider or a scope. Neither Send nor Sync: services stay on the creating thread. Cloning shares state; it never creates a new scope.
Implementations§
Source§impl ServiceProvider
impl ServiceProvider
Sourcepub fn same_as(&self, other: &ServiceProvider) -> bool
pub fn same_as(&self, other: &ServiceProvider) -> bool
Whether both handles are the same provider or scope.
pub fn is_disposed(&self) -> bool
pub fn create_scope(&self) -> ServiceResult<ServiceScope>
pub fn create_async_scope(&self) -> ServiceResult<AsyncServiceScope>
pub fn get_service<S: ?Sized + 'static>(&self) -> ServiceResult<Option<Rc<S>>>
pub fn get_required_service<S: ?Sized + 'static>(&self) -> ServiceResult<Rc<S>>
pub fn get_services<S: ?Sized + 'static>(&self) -> ServiceResult<Vec<Rc<S>>>
pub fn get_keyed_service<S: ?Sized + 'static>( &self, key: Option<&ServiceKey>, ) -> ServiceResult<Option<Rc<S>>>
pub fn get_required_keyed_service<S: ?Sized + 'static>( &self, key: Option<&ServiceKey>, ) -> ServiceResult<Rc<S>>
pub fn get_keyed_services<S: ?Sized + 'static>( &self, key: Option<&ServiceKey>, ) -> ServiceResult<Vec<Rc<S>>>
Sourcepub fn dispose(&self) -> ServiceResult<()>
pub fn dispose(&self) -> ServiceResult<()>
Disposes captured services in reverse construction order. Async-only services require
dispose_async; that error leaves the scope active so the caller can retry asynchronously.
pub fn dispose_async(&self) -> Task<()> ⓘ
Trait Implementations§
Source§impl Clone for ServiceProvider
impl Clone for ServiceProvider
Source§impl IAsyncDisposable for ServiceProvider
impl IAsyncDisposable for ServiceProvider
Source§impl IDisposable for ServiceProvider
impl IDisposable for ServiceProvider
Source§impl IKeyedServiceProvider for ServiceProvider
impl IKeyedServiceProvider for ServiceProvider
fn get_keyed_service_erased( &self, service_type: ServiceType, key: Option<ServiceKey>, ) -> ServiceResult<Option<ErasedService>>
fn get_required_keyed_service_erased( &self, service_type: ServiceType, key: Option<ServiceKey>, ) -> ServiceResult<ErasedService>
Source§impl IServiceProvider for ServiceProvider
impl IServiceProvider for ServiceProvider
fn ensure_active(&self) -> ServiceResult<()>
Source§fn required_service_provider(&self) -> Option<&dyn ISupportRequiredService>
fn required_service_provider(&self) -> Option<&dyn ISupportRequiredService>
Explicit capability query replaces CLR interface casts for alternate providers.
fn disposable(&self) -> Option<&dyn IDisposable>
fn get_service_erased( &self, id: &ServiceIdentifier, ) -> ServiceResult<Option<ErasedService>>
fn get_services_erased( &self, id: &ServiceIdentifier, ) -> ServiceResult<Vec<ErasedService>>
fn required_service_erased( &self, id: &ServiceIdentifier, ) -> ServiceResult<ErasedService>
Source§impl IServiceProviderIsKeyedService for ServiceProvider
impl IServiceProviderIsKeyedService for ServiceProvider
fn is_keyed_service( &self, service_type: ServiceType, key: Option<&ServiceKey>, ) -> bool
Source§impl IServiceProviderIsService for ServiceProvider
impl IServiceProviderIsService for ServiceProvider
fn is_service(&self, service_type: ServiceType) -> bool
Source§impl IServiceScopeFactory for ServiceProvider
impl IServiceScopeFactory for ServiceProvider
fn create_scope(&self) -> ServiceResult<ServiceScope>
fn create_async_scope(&self) -> ServiceResult<AsyncServiceScope>
Source§impl ISupportRequiredService for ServiceProvider
impl ISupportRequiredService for ServiceProvider
fn get_required_service_erased( &self, id: &ServiceIdentifier, ) -> ServiceResult<ErasedService>
Auto Trait Implementations§
impl !RefUnwindSafe for ServiceProvider
impl !Send for ServiceProvider
impl !Sync for ServiceProvider
impl !UnwindSafe for ServiceProvider
impl Freeze 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