Expand description
Root routing entry utilities.
This module re‑exports [push
] and [pop
] for manipulating the navigation stack
and provides the router_root
component which drives per‑frame execution of
the current (top) destination.
Core flow:
- On the first frame, the supplied
root_dest
is pushed if the stack is empty. - On every frame, the top destination’s
exec_component()
is invoked.
The actual stack and destination logic live in tessera_ui_shard::router
.
§Typical Minimal Usage
use tessera_ui::{tessera, shard, router::{router_root, Router}};
#[shard]
#[tessera]
fn home_screen() { /* ... */ }
// In your app's root layout:
router_root(HomeScreenDestination {});
#[shard]
#[tessera]
// Somewhere inside an event (e.g. button click) to navigate:
Router::with_mut(|router| {
router.push(SettingsScreenDestination {});
});
// To go back:
Router::with_mut(|router| {
router.pop();
});
§Behavior
router_root
is idempotent regarding the initial destination: it only pushesroot_dest
when the stack is empty.- Subsequent frames never push automatically; they only execute the current top.
- If the stack is externally cleared (not typical),
router_root
will push again.
§Panics
Panics if after internal logic the stack is still empty (indicates an unexpected mutation from user code while in the execution closure).
§See Also
tessera_ui_shard::router::RouterDestination
#[shard]
macro which generates*Destination
structs.
Structs§
Traits§
- Router
Destination - A navigation destination produced automatically by the
#[shard]
macro.
Functions§
- router_
root - Root component that drives the shard router stack each frame.