pub struct InstanceGenericFirstDependencyResolver { /* private fields */ }Expand description
A resolver whose registrations belong to the instance, kept per service type and contract
(InstanceGenericFirstDependencyResolver). It is the resolver AppLocator starts with.
A registration runs the callbacks of its service type and contract; disposing the resolver drops its registrations, disposes the constants and the created lazy singletons that were registered as disposable, and runs every callback once more.
Implementations§
Source§impl InstanceGenericFirstDependencyResolver
impl InstanceGenericFirstDependencyResolver
Sourcepub fn with_configuration(
configure: impl FnOnce(&dyn IMutableDependencyResolver),
) -> Self
pub fn with_configuration( configure: impl FnOnce(&dyn IMutableDependencyResolver), ) -> Self
A resolver that configure registers services with first
(InstanceGenericFirstDependencyResolver(Action<IMutableDependencyResolver>?)).
Trait Implementations§
Source§impl IMutableDependencyResolver for InstanceGenericFirstDependencyResolver
impl IMutableDependencyResolver for InstanceGenericFirstDependencyResolver
Source§fn has_registration_erased(
&self,
service_type: ServiceType,
contract: Option<&str>,
) -> bool
fn has_registration_erased( &self, service_type: ServiceType, contract: Option<&str>, ) -> bool
Whether a service is registered for
service_type and contract (HasRegistration<T>).Source§fn register_erased(
&self,
factory: ServiceFactory,
service_type: ServiceType,
contract: Option<&str>,
)
fn register_erased( &self, factory: ServiceFactory, service_type: ServiceType, contract: Option<&str>, )
Registers a factory, called for each resolution (
Register<T>(Func<T?>, string?)).Source§fn register_constant_erased(
&self,
value: Option<ErasedService>,
disposal: Option<Rc<dyn Fn()>>,
service_type: ServiceType,
contract: Option<&str>,
)
fn register_constant_erased( &self, value: Option<ErasedService>, disposal: Option<Rc<dyn Fn()>>, service_type: ServiceType, contract: Option<&str>, )
Registers a constant (
RegisterConstant<T>(T?, string?)). disposal is what disposing the
resolver does with it: upstream disposes a constant that is IDisposable.Source§fn register_lazy_singleton_erased(
&self,
factory: ServiceFactory,
disposal: Option<LazyDisposal>,
service_type: ServiceType,
contract: Option<&str>,
)
fn register_lazy_singleton_erased( &self, factory: ServiceFactory, disposal: Option<LazyDisposal>, service_type: ServiceType, contract: Option<&str>, )
Registers a singleton created by
factory on its first resolution
(RegisterLazySingleton<T>(Func<T?>, string?)). disposal is what disposing the resolver
does with the value once it was created.Source§fn unregister_current_erased(
&self,
service_type: ServiceType,
contract: Option<&str>,
)
fn unregister_current_erased( &self, service_type: ServiceType, contract: Option<&str>, )
Removes the last registration (
UnregisterCurrent<T>(string?)).Source§fn unregister_all_erased(
&self,
service_type: ServiceType,
contract: Option<&str>,
)
fn unregister_all_erased( &self, service_type: ServiceType, contract: Option<&str>, )
Removes every registration (
UnregisterAll<T>(string?)).Source§fn service_registration_callback_erased(
&self,
service_type: ServiceType,
contract: Option<&str>,
callback: RegistrationCallback,
) -> Rc<dyn IDisposable>
fn service_registration_callback_erased( &self, service_type: ServiceType, contract: Option<&str>, callback: RegistrationCallback, ) -> Rc<dyn IDisposable>
Calls
callback for every registration, those that exist and those to come, until the
returned disposable is disposed (ServiceRegistrationCallback<T>(string?, Action<IDisposable>)).Source§impl IReadonlyDependencyResolver for InstanceGenericFirstDependencyResolver
impl IReadonlyDependencyResolver for InstanceGenericFirstDependencyResolver
Source§fn get_service_erased(
&self,
service_type: ServiceType,
contract: Option<&str>,
) -> Option<ErasedService>
fn get_service_erased( &self, service_type: ServiceType, contract: Option<&str>, ) -> Option<ErasedService>
The last service registered for
service_type and contract, or None
(GetService<T>(string? contract)).Source§fn get_services_erased(
&self,
service_type: ServiceType,
contract: Option<&str>,
) -> Vec<ErasedService> ⓘ
fn get_services_erased( &self, service_type: ServiceType, contract: Option<&str>, ) -> Vec<ErasedService> ⓘ
Every service registered for
service_type and contract, in the order of registration
(GetServices<T>(string? contract)).Auto Trait Implementations§
impl !Freeze for InstanceGenericFirstDependencyResolver
impl !RefUnwindSafe for InstanceGenericFirstDependencyResolver
impl !Send for InstanceGenericFirstDependencyResolver
impl !Sync for InstanceGenericFirstDependencyResolver
impl !UnwindSafe for InstanceGenericFirstDependencyResolver
impl Unpin for InstanceGenericFirstDependencyResolver
impl UnsafeUnpin for InstanceGenericFirstDependencyResolver
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
impl<R> IDependencyResolver for R
Source§impl<R> MutableDependencyResolverExt for Rwhere
R: IMutableDependencyResolver + ?Sized,
impl<R> MutableDependencyResolverExt for Rwhere
R: IMutableDependencyResolver + ?Sized,
Source§fn has_registration<S: ?Sized + 'static>(&self) -> bool
fn has_registration<S: ?Sized + 'static>(&self) -> bool
HasRegistration<T>().Source§fn has_registration_with_contract<S: ?Sized + 'static>(
&self,
contract: Option<&str>,
) -> bool
fn has_registration_with_contract<S: ?Sized + 'static>( &self, contract: Option<&str>, ) -> bool
HasRegistration<T>(string? contract).Source§fn register<S: ?Sized + 'static>(
&self,
factory: impl Fn() -> Option<Rc<S>> + 'static,
)
fn register<S: ?Sized + 'static>( &self, factory: impl Fn() -> Option<Rc<S>> + 'static, )
Register<T>(Func<T?>).Source§fn register_with_contract<S: ?Sized + 'static>(
&self,
factory: impl Fn() -> Option<Rc<S>> + 'static,
contract: Option<&str>,
)
fn register_with_contract<S: ?Sized + 'static>( &self, factory: impl Fn() -> Option<Rc<S>> + 'static, contract: Option<&str>, )
Register<T>(Func<T?>, string? contract).Source§fn register_constant<S: ?Sized + 'static>(&self, value: Rc<S>)
fn register_constant<S: ?Sized + 'static>(&self, value: Rc<S>)
RegisterConstant<T>(T).Source§fn register_constant_with_contract<S: ?Sized + 'static>(
&self,
value: Rc<S>,
contract: Option<&str>,
)
fn register_constant_with_contract<S: ?Sized + 'static>( &self, value: Rc<S>, contract: Option<&str>, )
RegisterConstant<T>(T, string? contract).Source§fn register_constant_disposable<S: ?Sized + IDisposable + 'static>(
&self,
value: Rc<S>,
)
fn register_constant_disposable<S: ?Sized + IDisposable + 'static>( &self, value: Rc<S>, )
RegisterConstant<T>(T) of a constant that the resolver disposes when it is disposed.Source§fn register_constant_disposable_with_contract<S: ?Sized + IDisposable + 'static>(
&self,
value: Rc<S>,
contract: Option<&str>,
)
fn register_constant_disposable_with_contract<S: ?Sized + IDisposable + 'static>( &self, value: Rc<S>, contract: Option<&str>, )
RegisterConstant<T>(T, string? contract) of a constant that the resolver disposes when it
is disposed.Source§fn register_lazy_singleton<S: ?Sized + 'static>(
&self,
factory: impl Fn() -> Option<Rc<S>> + 'static,
)
fn register_lazy_singleton<S: ?Sized + 'static>( &self, factory: impl Fn() -> Option<Rc<S>> + 'static, )
RegisterLazySingleton<T>(Func<T?>).Source§fn register_lazy_singleton_with_contract<S: ?Sized + 'static>(
&self,
factory: impl Fn() -> Option<Rc<S>> + 'static,
contract: Option<&str>,
)
fn register_lazy_singleton_with_contract<S: ?Sized + 'static>( &self, factory: impl Fn() -> Option<Rc<S>> + 'static, contract: Option<&str>, )
RegisterLazySingleton<T>(Func<T?>, string? contract).Source§fn register_lazy_singleton_disposable<S: ?Sized + IDisposable + 'static>(
&self,
factory: impl Fn() -> Option<Rc<S>> + 'static,
)
fn register_lazy_singleton_disposable<S: ?Sized + IDisposable + 'static>( &self, factory: impl Fn() -> Option<Rc<S>> + 'static, )
RegisterLazySingleton<T>(Func<T?>) of a singleton that the resolver disposes, once
created, when it is disposed.Source§fn register_lazy_singleton_disposable_with_contract<S: ?Sized + IDisposable + 'static>(
&self,
factory: impl Fn() -> Option<Rc<S>> + 'static,
contract: Option<&str>,
)
fn register_lazy_singleton_disposable_with_contract<S: ?Sized + IDisposable + 'static>( &self, factory: impl Fn() -> Option<Rc<S>> + 'static, contract: Option<&str>, )
RegisterLazySingleton<T>(Func<T?>, string? contract) of a singleton that the resolver
disposes, once created, when it is disposed.Source§fn unregister_current<S: ?Sized + 'static>(&self)
fn unregister_current<S: ?Sized + 'static>(&self)
UnregisterCurrent<T>().Source§fn unregister_current_with_contract<S: ?Sized + 'static>(
&self,
contract: Option<&str>,
)
fn unregister_current_with_contract<S: ?Sized + 'static>( &self, contract: Option<&str>, )
UnregisterCurrent<T>(string? contract).Source§fn unregister_all<S: ?Sized + 'static>(&self)
fn unregister_all<S: ?Sized + 'static>(&self)
UnregisterAll<T>().Source§fn unregister_all_with_contract<S: ?Sized + 'static>(
&self,
contract: Option<&str>,
)
fn unregister_all_with_contract<S: ?Sized + 'static>( &self, contract: Option<&str>, )
UnregisterAll<T>(string? contract).Source§fn service_registration_callback<S: ?Sized + 'static>(
&self,
callback: impl Fn(&dyn IDisposable) + 'static,
) -> Rc<dyn IDisposable>
fn service_registration_callback<S: ?Sized + 'static>( &self, callback: impl Fn(&dyn IDisposable) + 'static, ) -> Rc<dyn IDisposable>
ServiceRegistrationCallback<T>(Action<IDisposable>).Source§fn service_registration_callback_with_contract<S: ?Sized + 'static>(
&self,
contract: Option<&str>,
callback: impl Fn(&dyn IDisposable) + 'static,
) -> Rc<dyn IDisposable>
fn service_registration_callback_with_contract<S: ?Sized + 'static>( &self, contract: Option<&str>, callback: impl Fn(&dyn IDisposable) + 'static, ) -> Rc<dyn IDisposable>
ServiceRegistrationCallback<T>(string? contract, Action<IDisposable>).Source§impl<R> ReadonlyDependencyResolverExt for Rwhere
R: IReadonlyDependencyResolver + ?Sized,
impl<R> ReadonlyDependencyResolverExt for Rwhere
R: IReadonlyDependencyResolver + ?Sized,
Source§impl<R> ResolverMixins for Rwhere
R: IMutableDependencyResolver + ?Sized,
impl<R> ResolverMixins for Rwhere
R: IMutableDependencyResolver + ?Sized,
Source§fn register_and<S: Default + 'static>(&self) -> &Self
fn register_and<S: Default + 'static>(&self) -> &Self
RegisterAnd<TService>(): a new S per resolution.Source§fn register_and_with_contract<S: Default + 'static>(
&self,
contract: &str,
) -> &Self
fn register_and_with_contract<S: Default + 'static>( &self, contract: &str, ) -> &Self
RegisterAnd<TService>(string contract).Source§fn register_and_factory<S: ?Sized + 'static>(
&self,
factory: impl Fn() -> Rc<S> + 'static,
) -> &Self
fn register_and_factory<S: ?Sized + 'static>( &self, factory: impl Fn() -> Rc<S> + 'static, ) -> &Self
RegisterAnd<TService>(Func<TService>).Source§fn register_and_factory_with_contract<S: ?Sized + 'static>(
&self,
factory: impl Fn() -> Rc<S> + 'static,
contract: &str,
) -> &Self
fn register_and_factory_with_contract<S: ?Sized + 'static>( &self, factory: impl Fn() -> Rc<S> + 'static, contract: &str, ) -> &Self
RegisterAnd<TService>(Func<TService>, string contract).Source§fn register_constant_and<S: Default + 'static>(&self) -> &Self
fn register_constant_and<S: Default + 'static>(&self) -> &Self
RegisterConstantAnd<TService>(): one new S, registered as a factory that returns it.Source§fn register_constant_and_with_contract<S: Default + 'static>(
&self,
contract: &str,
) -> &Self
fn register_constant_and_with_contract<S: Default + 'static>( &self, contract: &str, ) -> &Self
RegisterConstantAnd<TService>(string contract).Source§fn register_constant_and_value<S: ?Sized + 'static>(
&self,
value: Rc<S>,
) -> &Self
fn register_constant_and_value<S: ?Sized + 'static>( &self, value: Rc<S>, ) -> &Self
RegisterConstantAnd<TService>(TService value).Source§fn register_constant_and_value_with_contract<S: ?Sized + 'static>(
&self,
value: Rc<S>,
contract: &str,
) -> &Self
fn register_constant_and_value_with_contract<S: ?Sized + 'static>( &self, value: Rc<S>, contract: &str, ) -> &Self
RegisterConstantAnd<TService>(TService value, string contract).Source§fn register_lazy_singleton_and<S: Default + 'static>(&self) -> &Self
fn register_lazy_singleton_and<S: Default + 'static>(&self) -> &Self
RegisterLazySingletonAnd<TService>(): one S, created on the first resolution.Source§fn register_lazy_singleton_and_with_contract<S: Default + 'static>(
&self,
contract: &str,
) -> &Self
fn register_lazy_singleton_and_with_contract<S: Default + 'static>( &self, contract: &str, ) -> &Self
RegisterLazySingletonAnd<TService>(string contract).Source§impl<R> ServiceLocationInitializationExt for Rwhere
R: IMutableDependencyResolver + ?Sized,
impl<R> ServiceLocationInitializationExt for Rwhere
R: IMutableDependencyResolver + ?Sized,
Source§fn initialize_splat(&self)
fn initialize_splat(&self)
InitializeSplat.