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.
Members
newconverter_servicemain_thread_schedulertask_pool_schedulercurrentcurrent_mutablewith_main_thread_schedulerwith_main_thread_scheduler_withwith_task_pool_schedulerwith_task_pool_scheduler_withwith_registration_on_buildwith_custom_registrationwith_registrationwith_registrationswith_platform_serviceswith_core_serviceswith_platform_moduleusing_splat_moduleusing_splat_builderfor_custom_platformfor_platformswith_message_buswith_message_bus_withwith_message_bus_instanceconfigure_view_locatorconfigure_suspension_driverwith_converterwith_converter_ofwith_converter_factorywith_converter_of_factorywith_fallback_converterwith_fallback_converter_factorywith_set_method_converterwith_set_method_converter_factorywith_converters_fromwith_exception_handlerwith_suspension_hostwith_suspension_host_ofwith_suspension_host_instancewith_cache_sizesregister_view_modelregister_constant_view_modelregister_singleton_view_modelregister_viewregister_singleton_viewbuildbuild_app
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.
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.
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).
task_pool_scheduler
fn task_pool_scheduler(self: &Self) -> Option<Rc<dyn IScheduler>>
The scheduler of background work the builder was given (TaskpoolScheduler).
current
fn current(self: &Self) -> Option<Rc<dyn IReadonlyDependencyResolver>>
The resolver of the application, once known (Current).
current_mutable
fn current_mutable(self: &Self) -> Rc<dyn IMutableDependencyResolver>
The resolver the builder registers with (CurrentMutable).
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)).
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)).
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)).
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)).
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>)).
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).
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>)).
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.
with_platform_services
fn with_platform_services(self: &Self) -> &Self
Registers the services of the platform, once (WithPlatformServices).
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).
with_platform_module
fn with_platform_module<T: IWantsToRegisterStuff + Default>(self: &Self) -> &Self
Applies the registrations of a new T at once (WithPlatformModule<T>()).
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)).
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>)).
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>)).
for_platforms
fn for_platforms(self: &Self, platform_configurations: &[&dyn Fn(&dyn IReactiveUIBuilder) -> ()]) -> &Self
Applies the configuration of each platform (ForPlatforms(params Action<IReactiveUIBuilder>[])).
with_message_bus
fn with_message_bus(self: &Self) -> &Self
Registers a new message bus when the application is built (WithMessageBus()).
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>)).
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)).
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>)).
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>)).
with_converter
fn with_converter(self: &Self, converter: Rc<dyn IBindingTypeConverter>) -> &Self
Registers a converter of a pair of types (WithConverter(IBindingTypeConverter)).
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>)).
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>)).
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>>)).
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)).
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>)).
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)).
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>)).
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)).
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>)).
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()).
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>()).
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.
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).
register_view_model
fn register_view_model<VM: IReactiveObject + Default>(self: &Self) -> &Self
Registers VM, a new view model at each resolution (RegisterViewModel<TViewModel>()).
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>()).
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>()).
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>()).
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>()).
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).
build_app
fn build_app(self: &Self) -> &Self
Builds the application (BuildApp()), as build does.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeReactiveUIInstanceMixinsReactiveUIBuilderExtBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyReactiveUIBuilderMixinsDebugIAppInstanceIReactiveUIInstanceIAppBuilderIReactiveUIBuilder
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.