FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    ReactiveUIInstanceMixins

    trait · ferroui-reactiveui · v0.5.0

    trait ReactiveUIInstanceMixins: IReactiveUIInstance
    

    The resolution of services from a built application (BuilderMixins.WithInstance, and the WithInstance overloads of the builder).

    use ferroui_reactiveui::{ReactiveUIInstanceMixins, RxAppBuilder};
    use std::rc::Rc;
    
    RxAppBuilder::reset_for_testing();
    let builder = RxAppBuilder::create_reactive_ui_builder();
    builder.with_registration(|resolver| {
        use ferroui_splat::MutableDependencyResolverExt;
        resolver.register_constant(Rc::new(42_i32));
    });
    let mut seen = None;
    builder.build_app().with_instance(|(number, text): (Option<Rc<i32>>, Option<Rc<String>>)| {
        seen = Some((number.map(|number| *number), text.is_none()));
    });
    assert_eq!(seen, Some((Some(42), true)));
    

    View source

    Members

    with_instance

    fn with_instance<R: ResolveServices>(self: &Self, action: impl FnOnce(R) -> ()) -> &Self
    

    Resolves the services that the type of the argument of action names and calls action with them; nothing happens when the application has no resolver (WithInstance<T1, ..., Tn>(Action<T1?, ..., Tn?>)). Returns the application, to chain the calls.

    Source

    Trait implementations

    Availability

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