FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    ReactiveUIBuilder

    struct · ferroui-reactiveui · v0.5.0

    struct ReactiveUIBuilder
    

    The builder of a ReactiveUI application (ReactiveUIBuilder): Splat's AppBuilder with the services, schedulers, converters and state of ReactiveUI.

    use ferroui_reactiveui::RxAppBuilder;
    
    RxAppBuilder::reset_for_testing();
    let builder = RxAppBuilder::create_reactive_ui_builder();
    builder.with_core_services().with_cache_sizes(32, 128).build_app();
    RxAppBuilder::ensure_initialized();
    

    Deviation (DEVIATIONS.md, ReactiveUI): upstream derives the class from Splat's AppBuilder and overrides its virtual WithCoreServices; the builder here holds an AppBuilder and implements IAppBuilder itself, registering its core services before the inner builder applies the registrations. Each method returns the builder, to chain the calls on the concrete type, where upstream returns the interface; the same methods, returning trait objects, are those of IReactiveUIBuilder.

    View source

    Members

    new

    fn new(resolver: Rc<dyn IMutableDependencyResolver>, current: Option<Rc<dyn IReadonlyDependencyResolver>>) -> Self
    

    A builder over resolver, with current as the resolver of the application (ReactiveUIBuilder(IMutableDependencyResolver, IReadonlyDependencyResolver?)): it initializes Splat's services in the resolver and registers its converter service there.

    Source

    converter_service

    fn converter_service(self: &Self) -> &Rc<ConverterService>
    

    The service of the converters of the bindings (ConverterService): its typed, fallback and set-method registries, which the with_*converter* methods fill.

    Source

    main_thread_scheduler

    fn main_thread_scheduler(self: &Self) -> Option<Rc<dyn IScheduler>>
    

    The scheduler of the user-interface thread the builder was given (MainThreadScheduler).

    Source

    task_pool_scheduler

    fn task_pool_scheduler(self: &Self) -> Option<Rc<dyn IScheduler>>
    

    The scheduler of background work the builder was given (TaskpoolScheduler).

    Source

    current

    fn current(self: &Self) -> Option<Rc<dyn IReadonlyDependencyResolver>>
    

    The resolver of the application, once known (Current).

    Source

    current_mutable

    fn current_mutable(self: &Self) -> Rc<dyn IMutableDependencyResolver>
    

    The resolver the builder registers with (CurrentMutable).

    Source

    with_main_thread_scheduler

    fn with_main_thread_scheduler(self: &Self, scheduler: Rc<dyn IScheduler>) -> &Self
    

    Sets the scheduler of the user-interface thread, which also becomes RxSchedulers::main_thread_scheduler when the application is built (WithMainThreadScheduler(ISequencer)).

    Source

    with_main_thread_scheduler_with

    fn with_main_thread_scheduler_with(self: &Self, scheduler: Rc<dyn IScheduler>, set_rx_app: bool) -> &Self
    

    Sets the scheduler of the user-interface thread; set_rx_app says whether it becomes RxSchedulers::main_thread_scheduler (WithMainThreadScheduler(ISequencer, bool)).

    Source

    with_task_pool_scheduler

    fn with_task_pool_scheduler(self: &Self, scheduler: Rc<dyn IScheduler>) -> &Self
    

    Sets the scheduler of background work, which also becomes RxSchedulers::task_pool_scheduler when the application is built (WithTaskPoolScheduler(ISequencer)).

    Source

    with_task_pool_scheduler_with

    fn with_task_pool_scheduler_with(self: &Self, scheduler: Rc<dyn IScheduler>, set_rx_app: bool) -> &Self
    

    Sets the scheduler of background work; set_rx_app says whether it becomes RxSchedulers::task_pool_scheduler (WithTaskPoolScheduler(ISequencer, bool)).

    Source

    with_registration_on_build

    fn with_registration_on_build(self: &Self, configure_action: impl Fn(&dyn IMutableDependencyResolver) -> () + 'static) -> &Self
    

    Applies configure_action to the resolver when the application is built (WithRegistrationOnBuild(Action<IMutableDependencyResolver>)).

    Source

    with_custom_registration

    fn with_custom_registration(self: &Self, configure_action: impl Fn(&dyn IMutableDependencyResolver) -> () + 'static) -> &Self
    

    Adds registrations, applied to the resolver when the application is built (WithCustomRegistration(Action<IMutableDependencyResolver>) of Splat's builder).

    Source

    with_registration

    fn with_registration(self: &Self, configure_action: impl FnOnce(&dyn IMutableDependencyResolver) -> ()) -> &Self
    

    Applies configure_action to the resolver at once (WithRegistration(Action<IMutableDependencyResolver>)).

    Source

    with_registrations

    fn with_registrations(self: &Self, registration: &dyn IWantsToRegisterStuff) -> &Self
    

    Applies registration to the resolver at once, through a DependencyResolverRegistrar (WithRegistration(IWantsToRegisterStuff)), the migration path of the types that registered their services by assembly scanning.

    Source

    with_platform_services

    fn with_platform_services(self: &Self) -> &Self
    

    Registers the services of the platform, once (WithPlatformServices).

    Source

    with_core_services

    fn with_core_services(self: &Self) -> &Self
    

    Registers the core services of ReactiveUI, once: the default converters, the property observers, the view locator and the activation fetcher; and, each time, the scheduler configuration applied when the application is built (WithCoreServices).

    Source

    with_platform_module

    fn with_platform_module<T: IWantsToRegisterStuff + Default>(self: &Self) -> &Self
    

    Applies the registrations of a new T at once (WithPlatformModule<T>()).

    Source

    using_splat_module

    fn using_splat_module(self: &Self, registration_module: Rc<dyn IModule>) -> &Self
    

    Adds a Splat module, applied when the application is built (UsingSplatModule<T>(T)).

    Source

    using_splat_builder

    fn using_splat_builder(self: &Self, app_builder: Option<&dyn Fn(&dyn IAppBuilder) -> ()>) -> &Self
    

    Calls app_builder, if any, with the builder as a Splat builder (UsingSplatBuilder(Action<IAppBuilder>)).

    Source

    for_custom_platform

    fn for_custom_platform(self: &Self, main_thread_scheduler: Rc<dyn IScheduler>, platform_services: impl Fn(&dyn IMutableDependencyResolver) -> () + 'static) -> &Self
    

    Configures a platform of the application's own: its main thread scheduler, and its services, registered when the application is built (ForCustomPlatform(ISequencer, Action<IMutableDependencyResolver>)).

    Source

    for_platforms

    fn for_platforms(self: &Self, platform_configurations: &[&dyn Fn(&dyn IReactiveUIBuilder) -> ()]) -> &Self
    

    Applies the configuration of each platform (ForPlatforms(params Action<IReactiveUIBuilder>[])).

    Source

    with_message_bus

    fn with_message_bus(self: &Self) -> &Self
    

    Registers a new message bus when the application is built (WithMessageBus()).

    Source

    with_message_bus_with

    fn with_message_bus_with(self: &Self, configure: impl Fn(&dyn IMessageBus) -> () + 'static) -> &Self
    

    Registers a new message bus, configured by configure, when the application is built (WithMessageBus(Action<IMessageBus>)).

    Source

    with_message_bus_instance

    fn with_message_bus_instance(self: &Self, message_bus: Rc<dyn IMessageBus>) -> &Self
    

    Registers message_bus when the application is built (WithMessageBus(IMessageBus)).

    Source

    configure_view_locator

    fn configure_view_locator(self: &Self, configure: impl Fn(&DefaultViewLocator) -> () + 'static) -> &Self
    

    Configures the registered DefaultViewLocator when the application is built, keeping the mappings that register_views or with_view_module added; with none registered, a new one is configured and registered as the view locator (ConfigureViewLocator(Action<DefaultViewLocator>)).

    Source

    configure_suspension_driver

    fn configure_suspension_driver(self: &Self, configure: impl Fn(&Rc<dyn ISuspensionDriver>) -> () + 'static) -> &Self
    

    Configures the registered suspension driver, if there is one, when the application is built (ConfigureSuspensionDriver(Action<ISuspensionDriver>)).

    Source

    with_converter

    fn with_converter(self: &Self, converter: Rc<dyn IBindingTypeConverter>) -> &Self
    

    Registers a converter of a pair of types (WithConverter(IBindingTypeConverter)).

    Source

    with_converter_of

    fn with_converter_of<F: 'static, T: 'static>(self: &Self, converter: Rc<dyn IBindingTypeConverterOf<F, T>>) -> &Self
    

    Registers a converter of F to T (WithConverter<TFrom, TTo>(IBindingTypeConverter<TFrom, TTo>)).

    Source

    with_converter_factory

    fn with_converter_factory(self: &Self, factory: impl FnOnce() -> Rc<dyn IBindingTypeConverter>) -> &Self
    

    Registers the converter that factory creates (WithConverter(Func<IBindingTypeConverter>)).

    Source

    with_converter_of_factory

    fn with_converter_of_factory<F: 'static, T: 'static>(self: &Self, factory: impl FnOnce() -> Rc<dyn IBindingTypeConverterOf<F, T>>) -> &Self
    

    Registers the converter of F to T that factory creates (WithConverter<TFrom, TTo>(Func<IBindingTypeConverter<TFrom, TTo>>)).

    Source

    with_fallback_converter

    fn with_fallback_converter(self: &Self, converter: Rc<dyn IBindingFallbackConverter>) -> &Self
    

    Registers a fallback converter, asked when no converter of the exact pair of types is found (WithFallbackConverter(IBindingFallbackConverter)).

    Source

    with_fallback_converter_factory

    fn with_fallback_converter_factory(self: &Self, factory: impl FnOnce() -> Rc<dyn IBindingFallbackConverter>) -> &Self
    

    Registers the fallback converter that factory creates (WithFallbackConverter(Func<IBindingFallbackConverter>)).

    Source

    with_set_method_converter

    fn with_set_method_converter(self: &Self, converter: Rc<dyn ISetMethodBindingConverter>) -> &Self
    

    Registers a set-method converter, for the targets set through a method (WithSetMethodConverter(ISetMethodBindingConverter)).

    Source

    with_set_method_converter_factory

    fn with_set_method_converter_factory(self: &Self, factory: impl FnOnce() -> Rc<dyn ISetMethodBindingConverter>) -> &Self
    

    Registers the set-method converter that factory creates (WithSetMethodConverter(Func<ISetMethodBindingConverter>)).

    Source

    with_converters_from

    fn with_converters_from(self: &Self, resolver: &dyn IReadonlyDependencyResolver) -> &Self
    

    Registers the converters of the three kinds that resolver has, a migration helper from the registration in Splat (WithConvertersFrom(IReadonlyDependencyResolver)).

    Source

    with_exception_handler

    fn with_exception_handler(self: &Self, exception_handler: Rc<dyn IObserver<ObservableError>>) -> &Self
    

    Sets the handler of the errors that no thrown_exceptions subscriber handles (WithExceptionHandler(IObserver<Exception>)).

    Source

    with_suspension_host

    fn with_suspension_host(self: &Self) -> &Self
    

    Sets a suspension host, which becomes the one of RxSuspension when the application is built (WithSuspensionHost()).

    Source

    with_suspension_host_of

    fn with_suspension_host_of<T: 'static>(self: &Self) -> &Self
    

    Sets a suspension host of an application state of type T (WithSuspensionHost<TAppState>()).

    Source

    with_suspension_host_instance

    fn with_suspension_host_instance(self: &Self, suspension_host: Rc<dyn ISuspensionHost>) -> &Self
    

    Sets suspension_host as the suspension host, the common part of with_suspension_host and with_suspension_host_of.

    Source

    with_cache_sizes

    fn with_cache_sizes(self: &Self, small_cache_limit: usize, big_cache_limit: usize) -> &Self
    

    Sets the limits of the caches of ReactiveUI (WithCacheSizes(int, int)).

    Panics

    When a limit is zero (ArgumentOutOfRangeException).

    Source

    register_view_model

    fn register_view_model<VM: IReactiveObject + Default>(self: &Self) -> &Self
    

    Registers VM, a new view model at each resolution (RegisterViewModel<TViewModel>()).

    Source

    register_constant_view_model

    fn register_constant_view_model<VM: IReactiveObject + Default>(self: &Self) -> &Self
    

    Registers one view model of VM, created now, as a constant (RegisterConstantViewModel<TViewModel>()).

    Source

    register_singleton_view_model

    fn register_singleton_view_model<VM: IReactiveObject + Default>(self: &Self) -> &Self
    

    Registers VM, one view model created at the first resolution (RegisterSingletonViewModel<TViewModel>()).

    Source

    register_view

    fn register_view<V: IViewForOf<VM> + Default + 'static, VM: IReactiveObject>(self: &Self) -> &Self
    

    Registers V as the view of VM, a new view at each resolution (RegisterView<TView, TViewModel>()).

    Source

    register_singleton_view

    fn register_singleton_view<V: IViewForOf<VM> + Default + 'static, VM: IReactiveObject>(self: &Self) -> &Self
    

    Registers V as the view of VM, one view created at the first resolution (RegisterSingletonView<TView, TViewModel>()).

    Source

    build

    fn build(self: &Self) -> &Self
    

    Builds the application once, with its core services and registrations, then initializes the state of ReactiveUI: the limits of the caches, the handler of the errors, the suspension host, the converters of the bindings and the message bus; and marks ReactiveUI as initialized (RxAppBuilder::ensure_initialized). A second build returns the application as it is (Build()).

    Panics

    When the application has no resolver (InvalidOperationException).

    Source

    build_app

    fn build_app(self: &Self) -> &Self
    

    Builds the application (BuildApp()), as build does.

    Source

    Trait implementations

    Availability

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