Function di::singleton_factory

source ·
pub fn singleton_factory<T: Any + ?Sized, F>(factory: F) -> ServiceDescriptor
where F: Fn(&ServiceProvider) -> Ref<T> + 'static,
Available on crate feature builder only.
Expand description

Initializes a new singleton ServiceDescriptor.

Arguments

  • factory - The factory method used to create the service