FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    ViewMappingBuilder

    struct · ferroui-reactiveui · v0.5.0

    struct ViewMappingBuilder<'a>
    

    Registers the mappings of view models to views on a DefaultViewLocator, each method returning the builder to chain the calls (ViewMappingBuilder).

    Deviation (DEVIATIONS.md, ReactiveUI): the builder borrows its locator. The overloads without a contract are the same methods with None.

    View source

    Members

    new

    fn new(locator: &'a DefaultViewLocator) -> Self
    

    A builder that registers on locator (ViewMappingBuilder(DefaultViewLocator)).

    Source

    map

    fn map<VM: 'static, V: IViewFor + Default>(self: &Self, contract: Option<&str>) -> &Self
    

    Maps the view model type VM, under contract (None for the default), to a new view of type V, replacing an existing mapping (Map<TViewModel, TView>(string?)).

    Source

    map_factory

    fn map_factory<VM: 'static>(self: &Self, factory: impl Fn() -> Rc<dyn IViewFor> + 'static, contract: Option<&str>) -> &Self
    

    Maps the view model type VM, under contract, to the view factory creates (Map<TViewModel>(Func<IViewFor>, string?)).

    Source

    map_from_service_locator

    fn map_from_service_locator<VM: 'static, V: IntoViewFor + ?Sized + 'static>(self: &Self, contract: Option<&str>, service_contract: Option<&str>) -> &Self
    

    Maps the view model type VM, under contract, to the view the service locator gives for the service type V under service_contract (None for the registration without a contract), asked each time the mapping resolves (MapFromServiceLocator<TViewModel, TView>(string?, string?)). V is a view type or a trait object of one (dyn IViewForOf<VM>).

    A view that is not registered panics with an InvalidOperationException message when the mapping resolves, rather than resolving to nothing or to a view registered under another contract.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • Debug

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.