pub struct ServiceDescriptor { /* private fields */ }Expand description
A registration. Construct typed factories with new or from_factory; erased registration
exists for adapters. Instance registrations are externally owned and never disposed.
Implementations§
Source§impl ServiceDescriptor
impl ServiceDescriptor
pub fn new<S: ?Sized + 'static, F>( lifetime: ServiceLifetime, factory: F, ) -> Self
pub fn keyed<S: ?Sized + 'static, F>( lifetime: ServiceLifetime, key: Option<ServiceKey>, factory: F, ) -> Self
pub fn from_erased( identifier: ServiceIdentifier, lifetime: ServiceLifetime, factory: impl Fn(&ServiceProvider, Option<&ServiceKey>) -> ServiceResult<ErasedService> + 'static, ) -> Self
pub fn instance<S: ?Sized + 'static>(value: Rc<S>) -> Self
Sourcepub fn enumerable_instance<S: ?Sized + 'static>(values: Vec<Rc<S>>) -> Self
pub fn enumerable_instance<S: ?Sized + 'static>(values: Vec<Rc<S>>) -> Self
Explicit enumerable registration overrides the collection synthesized from individual services.
pub fn from_factory<S: ?Sized + 'static>( lifetime: ServiceLifetime, factory: ObjectFactory<S>, ) -> Self
pub fn with_key(self, key: Option<ServiceKey>) -> Self
pub fn with_dependencies(self, dependencies: Vec<Dependency>) -> Self
Sourcepub fn with_implementation<I: ?Sized + 'static>(self) -> Self
pub fn with_implementation<I: ?Sized + 'static>(self) -> Self
Identity used by TryAddEnumerable to distinguish implementations of the same service.
pub fn with_disposal<S: ?Sized + IDisposable + 'static>(self) -> Self
pub fn with_async_disposal<S: ?Sized + IAsyncDisposable + 'static>(self) -> Self
pub fn on_dispose<S: ?Sized + 'static>( self, dispose: impl Fn(&S) + 'static, ) -> Self
pub fn on_dispose_async<S: ?Sized + 'static>( self, dispose: impl Fn(Rc<S>) -> Task<()> + 'static, ) -> Self
pub fn implementation_type(&self) -> Option<ServiceType>
pub fn implementation_instance(&self) -> Option<ErasedService>
pub fn implementation_factory(&self) -> Option<ErasedFactory>
pub fn service_type(&self) -> ServiceType
pub fn service_key(&self) -> Option<&ServiceKey>
pub fn lifetime(&self) -> ServiceLifetime
pub fn is_keyed_service(&self) -> bool
pub fn dependencies(&self) -> &[Dependency]
Trait Implementations§
Source§impl Clone for ServiceDescriptor
impl Clone for ServiceDescriptor
Source§impl Debug for ServiceDescriptor
impl Debug for ServiceDescriptor
Auto Trait Implementations§
impl !RefUnwindSafe for ServiceDescriptor
impl !Send for ServiceDescriptor
impl !Sync for ServiceDescriptor
impl !UnwindSafe for ServiceDescriptor
impl Freeze for ServiceDescriptor
impl Unpin for ServiceDescriptor
impl UnsafeUnpin for ServiceDescriptor
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