AppLocator
struct · ferroui-splat · v0.5.0
struct AppLocator
The service locator of the application (AppLocator): the current resolver, which
applications and libraries resolve their services from, and the notifications of its changes.
It starts with an empty InstanceGenericFirstDependencyResolver; set_locator replaces
it.
Members
currentcurrent_mutableregister_resolver_initializerset_locatorget_locatorregister_resolver_callback_changedsuppress_resolver_callback_changed_notificationsare_resolver_callback_changed_notifications_enabledget_serviceget_service_with_contractget_servicesget_services_with_contracthas_registrationhas_registration_with_contractregisterregister_with_contractregister_constantregister_constant_with_contractregister_lazy_singletonregister_lazy_singleton_with_contractunregister_currentunregister_current_with_contractunregister_allunregister_all_with_contract
current
fn current() -> Rc<dyn IReadonlyDependencyResolver>
The current resolver, to resolve services from (Current).
current_mutable
fn current_mutable() -> Rc<dyn IMutableDependencyResolver>
The current resolver, to register services with (CurrentMutable).
register_resolver_initializer
fn register_resolver_initializer(initializer: impl Fn(&dyn IMutableDependencyResolver) -> () + 'static)
Sets what the locator runs on every new resolver (RegisterResolverInitializer); it
replaces the previous initializer.
set_locator
fn set_locator(dependency_resolver: Rc<dyn IDependencyResolver>)
Makes dependency_resolver the current resolver and notifies the callbacks
(SetLocator).
get_locator
fn get_locator() -> Rc<dyn IDependencyResolver>
The current resolver (GetLocator).
register_resolver_callback_changed
fn register_resolver_callback_changed(callback: impl Fn() -> () + 'static) -> Rc<dyn IDisposable>
Calls callback now, while notifications are enabled, and whenever the resolver changes,
until the returned disposable is disposed (RegisterResolverCallbackChanged).
suppress_resolver_callback_changed_notifications
fn suppress_resolver_callback_changed_notifications() -> Rc<dyn IDisposable>
Suppresses the notifications of the changes of the resolver until the returned disposable
is disposed (SuppressResolverCallbackChangedNotifications).
are_resolver_callback_changed_notifications_enabled
fn are_resolver_callback_changed_notifications_enabled() -> bool
AreResolverCallbackChangedNotificationsEnabled.
get_service
fn get_service<S: ?Sized + 'static>() -> Option<Rc<S>>
GetService<T>() of the current resolver.
get_service_with_contract
fn get_service_with_contract<S: ?Sized + 'static>(contract: &str) -> Option<Rc<S>>
GetService<T>(string contract) of the current resolver.
get_services
fn get_services<S: ?Sized + 'static>() -> Vec<Rc<S>>
GetServices<T>() of the current resolver.
get_services_with_contract
fn get_services_with_contract<S: ?Sized + 'static>(contract: &str) -> Vec<Rc<S>>
GetServices<T>(string contract) of the current resolver.
has_registration
fn has_registration<S: ?Sized + 'static>() -> bool
HasRegistration<T>() of the current resolver.
has_registration_with_contract
fn has_registration_with_contract<S: ?Sized + 'static>(contract: &str) -> bool
HasRegistration<T>(string contract) of the current resolver.
register
fn register<S: ?Sized + 'static>(factory: impl Fn() -> Option<Rc<S>> + 'static)
Register<T>(Func<T?>) with the current resolver.
register_with_contract
fn register_with_contract<S: ?Sized + 'static>(factory: impl Fn() -> Option<Rc<S>> + 'static, contract: &str)
Register<T>(Func<T?>, string contract) with the current resolver.
register_constant
fn register_constant<S: ?Sized + 'static>(value: Rc<S>)
RegisterConstant<T>(T) with the current resolver.
register_constant_with_contract
fn register_constant_with_contract<S: ?Sized + 'static>(value: Rc<S>, contract: &str)
RegisterConstant<T>(T, string contract) with the current resolver.
register_lazy_singleton
fn register_lazy_singleton<S: ?Sized + 'static>(factory: impl Fn() -> Option<Rc<S>> + 'static)
RegisterLazySingleton<T>(Func<T?>) with the current resolver.
register_lazy_singleton_with_contract
fn register_lazy_singleton_with_contract<S: ?Sized + 'static>(factory: impl Fn() -> Option<Rc<S>> + 'static, contract: &str)
RegisterLazySingleton<T>(Func<T?>, string contract) with the current resolver.
unregister_current
fn unregister_current<S: ?Sized + 'static>()
UnregisterCurrent<T>() of the current resolver.
unregister_current_with_contract
fn unregister_current_with_contract<S: ?Sized + 'static>(contract: &str)
UnregisterCurrent<T>(string contract) of the current resolver.
unregister_all
fn unregister_all<S: ?Sized + 'static>()
UnregisterAll<T>() of the current resolver.
unregister_all_with_contract
fn unregister_all_with_contract<S: ?Sized + 'static>(contract: &str)
UnregisterAll<T>(string contract) of the current resolver.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>Any
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.