Skip to main content

TransitionDelegate

Trait TransitionDelegate 

Source
pub trait TransitionDelegate: 'static {
    // Required method
    fn resolve(
        &self,
        app: &mut App,
        new_page_route_history: &[Handle<RouteEntry>],
        location_to_exiting_page_route: &HashMap<Option<Handle<RouteEntry>>, Handle<RouteEntry>>,
        page_route_to_pageless_routes: &HashMap<Option<Handle<RouteEntry>>, Vec<Handle<RouteEntry>>>,
    ) -> Vec<Handle<RouteEntry>>;
}
Expand description

The delegate that decides how pages added and removed from Navigator::pages transition in or out of the screen.

This trait implements the API to be called by Navigator when it requires explicit decisions on how the routes transition on or off the screen.

To make route transition decisions, an implementor implements resolve.

See also:

Required Methods§

Source

fn resolve( &self, app: &mut App, new_page_route_history: &[Handle<RouteEntry>], location_to_exiting_page_route: &HashMap<Option<Handle<RouteEntry>>, Handle<RouteEntry>>, page_route_to_pageless_routes: &HashMap<Option<Handle<RouteEntry>>, Vec<Handle<RouteEntry>>>, ) -> Vec<Handle<RouteEntry>>

A method that will be called by the Navigator to decide how routes transition in or out of the screen when Navigator::pages is updated.

The new_page_route_history list contains all page-based routes in the order that will be on the navigator’s history stack after this update completes. If a route in it has RouteTransitionRecord::is_waiting_for_entering_decision set to true, this route requires an explicit decision on how it should transition onto the navigator. To make a decision, call RouteTransitionRecord::mark_for_push or RouteTransitionRecord::mark_for_add.

location_to_exiting_page_route contains the page-based routes that are removed from the routes history after the page update. This map records page-based routes to be removed with the location of the route in the original route history before the update. The keys are the locations represented by the page-based routes that are directly below the removed routes, and the values are the page-based routes to be removed. The location is None if the route to be removed is the bottom-most route.

page_route_to_pageless_routes records the page-based routes and their associated pageless routes.

Once all the decisions have been made, this method must merge the removed routes (whether or not they require decisions) and new_page_route_history and return the merged result. The return list must preserve the same order of routes in new_page_route_history; the removed routes can be inserted into the return list freely as long as all of them are included.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§