Skip to main content

ServiceProvider

Struct ServiceProvider 

Source
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

Source

pub fn same_as(&self, other: &ServiceProvider) -> bool

Whether both handles are the same provider or scope.

Source

pub fn is_disposed(&self) -> bool

Source

pub fn create_scope(&self) -> ServiceResult<ServiceScope>

Source

pub fn create_async_scope(&self) -> ServiceResult<AsyncServiceScope>

Source

pub fn get_service<S: ?Sized + 'static>(&self) -> ServiceResult<Option<Rc<S>>>

Source

pub fn get_required_service<S: ?Sized + 'static>(&self) -> ServiceResult<Rc<S>>

Source

pub fn get_services<S: ?Sized + 'static>(&self) -> ServiceResult<Vec<Rc<S>>>

Source

pub fn get_keyed_service<S: ?Sized + 'static>( &self, key: Option<&ServiceKey>, ) -> ServiceResult<Option<Rc<S>>>

Source

pub fn get_required_keyed_service<S: ?Sized + 'static>( &self, key: Option<&ServiceKey>, ) -> ServiceResult<Rc<S>>

Source

pub fn get_keyed_services<S: ?Sized + 'static>( &self, key: Option<&ServiceKey>, ) -> ServiceResult<Vec<Rc<S>>>

Source

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.

Source

pub fn dispose_async(&self) -> Task<()> ⓘ

Trait Implementations§

Source§

impl Clone for ServiceProvider

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl IAsyncDisposable for ServiceProvider

Source§

impl IDisposable for ServiceProvider

Source§

fn dispose(&self)

Source§

impl IKeyedServiceProvider for ServiceProvider

Source§

impl IServiceProvider for ServiceProvider

Source§

impl IServiceProviderIsKeyedService for ServiceProvider

Source§

fn is_keyed_service( &self, service_type: ServiceType, key: Option<&ServiceKey>, ) -> bool

Source§

impl IServiceProviderIsService for ServiceProvider

Source§

fn is_service(&self, service_type: ServiceType) -> bool

Source§

impl IServiceScopeFactory for ServiceProvider

Source§

impl ISupportRequiredService for ServiceProvider

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ServiceProviderServiceExtensions for T
where T: IServiceProvider + ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.