IViewLocator
trait · ferroui-reactiveui · v0.5.0
trait IViewLocator: IEnableLogger + Any
Resolves the views of view models (IViewLocator).
A view model held as an Rc<dyn Any> is resolved by resolve_view,
which only asks what was registered for its type without the service locator, and by
resolve_view_unsafe, which also asks the service locator. A
view model whose type is known is resolved by resolve_view_typed,
which the generic resolve_view_of calls.
The trait is object safe (the locator is a service, Rc<dyn IViewLocator>); it is Any, so
that ViewLocatorMixins finds the
DefaultViewLocator behind it.
Deviation (DEVIATIONS.md, ReactiveUI): the generic member ResolveView<TViewModel>(TViewModel, string?) cannot be part of a trait object; it is resolve_view_typed,
which takes the view model type-erased with a ViewModelType that stands for its
compile-time type.
Members
resolve_view_typed
fn resolve_view_typed(self: &Self, view_model: Rc<dyn Any>, view_model_type: &ViewModelType, contract: Option<&str>) -> Option<Rc<dyn IViewFor>>
Resolves the view of view_model under contract (None for the default view) through
its compile-time type view_model_type, or None if there is no view
(ResolveView<TViewModel>(TViewModel, string?)).
resolve_view
fn resolve_view(self: &Self, view_model: Option<Rc<dyn Any>>, contract: Option<&str>) -> Option<Rc<dyn IViewFor>>
Resolves the view of view_model by its run-time type, without the service locator, or
None if there is no view or no view model (ResolveView(object?, string?)).
resolve_view_unsafe
fn resolve_view_unsafe(self: &Self, view_model: Option<Rc<dyn Any>>, contract: Option<&str>) -> Option<Rc<dyn IViewFor>>
Resolves the view of view_model by its run-time type as
resolve_view does, then through the service locator
(ResolveViewUnsafe(object?, string?)).
Trait implementations
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.