pub struct ServiceDescriptor {
pub service_id: ServiceId,
pub implementation_id: TypeId,
pub lifetime: ServiceScope,
pub activation_strategy: ServiceActivationStrategy,
pub dependencies: Vec<ServiceId>,
}
Expand description
Service descriptor containing all metadata for a service
Fields§
§service_id: ServiceId
Service identifier (type + optional name)
implementation_id: TypeId
Implementation type ID
lifetime: ServiceScope
Service lifetime/scope
activation_strategy: ServiceActivationStrategy
Strategy for creating instances
dependencies: Vec<ServiceId>
Dependencies this service requires
Implementations§
Source§impl ServiceDescriptor
impl ServiceDescriptor
Sourcepub fn bind<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>() -> ServiceDescriptorBuilder<TInterface, TImpl>
pub fn bind<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>() -> ServiceDescriptorBuilder<TInterface, TImpl>
Create a new service descriptor with type binding
Sourcepub fn bind_named<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>(
name: impl Into<String>,
) -> ServiceDescriptorBuilder<TInterface, TImpl>
pub fn bind_named<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>( name: impl Into<String>, ) -> ServiceDescriptorBuilder<TInterface, TImpl>
Create a named service descriptor
Sourcepub fn singleton<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>() -> ServiceDescriptorBuilder<TInterface, TImpl>
pub fn singleton<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>() -> ServiceDescriptorBuilder<TInterface, TImpl>
Create a singleton service descriptor
Sourcepub fn transient<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>() -> ServiceDescriptorBuilder<TInterface, TImpl>
pub fn transient<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>() -> ServiceDescriptorBuilder<TInterface, TImpl>
Create a transient service descriptor
Sourcepub fn autowired<T: 'static>(dependencies: Vec<ServiceId>) -> ServiceDescriptor
pub fn autowired<T: 'static>(dependencies: Vec<ServiceId>) -> ServiceDescriptor
Create an auto-wired service descriptor
Sourcepub fn autowired_singleton<T: 'static>(
dependencies: Vec<ServiceId>,
) -> ServiceDescriptor
pub fn autowired_singleton<T: 'static>( dependencies: Vec<ServiceId>, ) -> ServiceDescriptor
Create an auto-wired singleton service descriptor
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ServiceDescriptor
impl !RefUnwindSafe for ServiceDescriptor
impl Send for ServiceDescriptor
impl Sync for ServiceDescriptor
impl Unpin for ServiceDescriptor
impl !UnwindSafe 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