FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    RoutingState

    struct · ferroui-reactiveui · v0.5.0

    struct RoutingState
    

    The stack of view models of a screen, and the commands that navigate it (RoutingState).

    An IScreen holds one to coordinate the navigation of an application of several pages. The stack is last in, first out: navigate pushes a view model, navigate_back pops one, and navigate_and_reset replaces the whole stack.

    Every notification of the navigation is an observable of values: current_view_model gives the view model on top of the stack, navigation_stack_changed gives the whole stack after each change, and can_navigate_back whether there is a view model to go back to.

    The router is shared (Rc<RoutingState>); its observables and commands refer to it weakly, so that they do not keep it alive.

    View source

    Members

    new

    fn new() -> Rc<Self>
    

    A router with an empty stack, whose navigation notifies on RxSchedulers::main_thread_scheduler (RoutingState()).

    Source

    with_scheduler

    fn with_scheduler(scheduler: Option<Rc<dyn IScheduler>>) -> Rc<Self>
    

    A router whose navigation notifies on scheduler, or on RxSchedulers::main_thread_scheduler when None (RoutingState(IScheduler?)).

    Source

    navigation_stack

    fn navigation_stack(self: &Self) -> NavigationStack
    

    The navigation stack, the last view model being the current one (NavigationStack).

    Source

    set_navigation_stack

    fn set_navigation_stack(self: &Self, value: NavigationStack)
    

    Replaces the navigation stack (NavigationStack { set; }). The observables observe the stack the router has when they are subscribed.

    Source

    navigate_back

    fn navigate_back(self: &Self) -> NavigateBackCommand
    

    Navigates back to the previous view model of the stack, and emits the new current one (NavigateBack). It can execute while the stack holds at least two view models.

    Source

    set_navigate_back

    fn set_navigate_back(self: &Self, value: NavigateBackCommand)
    

    Replaces navigate_back (its protected setter).

    Source

    navigate

    fn navigate(self: &Self) -> NavigateCommand
    

    Pushes a view model on the stack, and emits it once the navigation scheduler delivers it (Navigate). Executing it with None fails, as upstream fails for null.

    Source

    set_navigate

    fn set_navigate(self: &Self, value: NavigateCommand)
    

    Replaces navigate (its protected setter).

    Source

    navigate_and_reset

    fn navigate_and_reset(self: &Self) -> NavigateCommand
    

    Replaces the whole stack with a view model, clearing the history of the navigation (NavigateAndReset).

    Source

    set_navigate_and_reset

    fn set_navigate_and_reset(self: &Self, value: NavigateCommand)
    

    Replaces navigate_and_reset (its protected setter).

    Source

    current_view_model

    fn current_view_model(self: &Self) -> Rc<dyn IObservable<Option<RoutableViewModel>>>
    

    The view model on top of the stack: the current one on subscription, then again after every change of the stack; None while the stack is empty (CurrentViewModel).

    Source

    set_current_view_model

    fn set_current_view_model(self: &Self, value: Rc<dyn IObservable<Option<RoutableViewModel>>>)
    

    Replaces current_view_model (its protected setter).

    Source

    navigation_stack_changed

    fn navigation_stack_changed(self: &Self) -> Rc<dyn IObservable<NavigationStackSnapshot>>
    

    A copy of the whole stack after each change of navigation_stack, oldest first; nothing on subscription (NavigationStackChanged).

    Source

    set_navigation_stack_changed

    fn set_navigation_stack_changed(self: &Self, value: Rc<dyn IObservable<NavigationStackSnapshot>>)
    

    Replaces navigation_stack_changed (its protected setter); current_view_model and can_navigate_back follow the replacement.

    Source

    can_navigate_back

    fn can_navigate_back(self: &Self) -> Rc<dyn IObservable<bool>>
    

    Whether there is a view model to go back to, which holds while the stack has at least two: the current answer on subscription, then each change of it (CanNavigateBack).

    Source

    set_can_navigate_back

    fn set_can_navigate_back(self: &Self, value: Rc<dyn IObservable<bool>>)
    

    Replaces can_navigate_back (its protected setter).

    Source

    Trait implementations

    Availability

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