ServiceDescriptor
struct · ferroui-dependency-injection · v0.5.0
struct ServiceDescriptor
A registration. Construct typed factories with new or from_factory; erased registration
exists for adapters. Instance registrations are externally owned and never disposed.
Members
newkeyedfrom_erasedinstanceenumerable_instancefrom_factorywith_keywith_dependencieswith_implementationwith_disposalwith_async_disposalon_disposeon_dispose_asyncimplementation_typeimplementation_instanceimplementation_factoryservice_typeservice_keylifetimeis_keyed_servicedependencies
new
fn new<S: ?Sized + 'static, F>(lifetime: ServiceLifetime, factory: F) -> Self
where F: Fn(&ServiceProvider) -> ServiceResult<Rc<S>> + 'static
keyed
fn keyed<S: ?Sized + 'static, F>(lifetime: ServiceLifetime, key: Option<ServiceKey>, factory: F) -> Self
where F: Fn(&ServiceProvider, Option<&ServiceKey>) -> ServiceResult<Rc<S>> + 'static
from_erased
fn from_erased(identifier: ServiceIdentifier, lifetime: ServiceLifetime, factory: impl Fn(&ServiceProvider, Option<&ServiceKey>) -> ServiceResult<ErasedService> + 'static) -> Self
instance
fn instance<S: ?Sized + 'static>(value: Rc<S>) -> Self
enumerable_instance
fn enumerable_instance<S: ?Sized + 'static>(values: Vec<Rc<S>>) -> Self
Explicit enumerable registration overrides the collection synthesized from individual services.
from_factory
fn from_factory<S: ?Sized + 'static>(lifetime: ServiceLifetime, factory: ObjectFactory<S>) -> Self
with_key
fn with_key(self: Self, key: Option<ServiceKey>) -> Self
with_dependencies
fn with_dependencies(self: Self, dependencies: Vec<Dependency>) -> Self
with_implementation
fn with_implementation<I: ?Sized + 'static>(self: Self) -> Self
Identity used by TryAddEnumerable to distinguish implementations of the same service.
with_disposal
fn with_disposal<S: ?Sized + IDisposable + 'static>(self: Self) -> Self
with_async_disposal
fn with_async_disposal<S: ?Sized + IAsyncDisposable + 'static>(self: Self) -> Self
on_dispose
fn on_dispose<S: ?Sized + 'static>(self: Self, dispose: impl Fn(&S) -> () + 'static) -> Self
on_dispose_async
fn on_dispose_async<S: ?Sized + 'static>(self: Self, dispose: impl Fn(Rc<S>) -> DisposeTask + 'static) -> Self
implementation_type
fn implementation_type(self: &Self) -> Option<ServiceType>
implementation_instance
fn implementation_instance(self: &Self) -> Option<ErasedService>
implementation_factory
fn implementation_factory(self: &Self) -> Option<crate::service_descriptor::ErasedFactory>
service_type
fn service_type(self: &Self) -> ServiceType
service_key
fn service_key(self: &Self) -> Option<&ServiceKey>
lifetime
fn lifetime(self: &Self) -> ServiceLifetime
is_keyed_service
fn is_keyed_service(self: &Self) -> bool
dependencies
fn dependencies(self: &Self) -> &[Dependency]
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedToStringCloneDebugDisplay
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.