Struct di::ServiceDescriptorBuilder
source · pub struct ServiceDescriptorBuilder<TSvc: Any + ?Sized, TImpl> { /* private fields */ }Available on crate feature
builder only.Expand description
Represents a ServiceDescriptor builder.
Implementations§
source§impl<TSvc: Any + ?Sized, TImpl> ServiceDescriptorBuilder<TSvc, TImpl>
impl<TSvc: Any + ?Sized, TImpl> ServiceDescriptorBuilder<TSvc, TImpl>
sourcepub fn from(
self,
factory: impl Fn(&ServiceProvider) -> Ref<TSvc> + 'static
) -> ServiceDescriptor
pub fn from( self, factory: impl Fn(&ServiceProvider) -> Ref<TSvc> + 'static ) -> ServiceDescriptor
Defines the factory method used to activate the service and returns the ServiceDescriptor.
Arguments
factory- The factory method used to create the service
sourcepub fn depends_on(self, dependency: ServiceDependency) -> Self
pub fn depends_on(self, dependency: ServiceDependency) -> Self
Defines a dependency used by the service.
Arguments
dependency- The dependency associated with the service
sourcepub fn new(lifetime: ServiceLifetime, implementation_type: Type) -> Self
pub fn new(lifetime: ServiceLifetime, implementation_type: Type) -> Self
Auto Trait Implementations§
impl<TSvc: ?Sized, TImpl> RefUnwindSafe for ServiceDescriptorBuilder<TSvc, TImpl>where
TImpl: RefUnwindSafe,
TSvc: RefUnwindSafe,
impl<TSvc: ?Sized, TImpl> Send for ServiceDescriptorBuilder<TSvc, TImpl>
impl<TSvc: ?Sized, TImpl> Sync for ServiceDescriptorBuilder<TSvc, TImpl>
impl<TSvc: ?Sized, TImpl> Unpin for ServiceDescriptorBuilder<TSvc, TImpl>
impl<TSvc: ?Sized, TImpl> UnwindSafe for ServiceDescriptorBuilder<TSvc, TImpl>where
TImpl: UnwindSafe,
TSvc: UnwindSafe,
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