Module router

Module router 

Source
Expand description

Stack-based routing utilities for shard components.

Each #[shard] function generates a *Destination type that implements RouterDestination. These destinations are managed in a LIFO stack.

§Responsibilities

  • Maintain an ordered stack (route_stack) of active destinations
  • Expose [push] / [pop] helpers that also manage shard state lifetimes
  • Remove per‑shard state from the registry when a destination whose lifecycle is ShardStateLifeCycle::Shard is popped
  • Keep routing logic minimal; rendering happens when the top destination’s exec_component() is invoked every frame by router_root

§Typical Usage

// Navigate forward
tessera_ui::router::push(HomeScreenDestination { /* fields */ });
// Navigate back
tessera_ui::router::pop();
  • #[shard] macro – generates the *Destination structs + optional state injection
  • tessera_ui::router::router_root – executes the current top destination each frame

Structs§

Router

Traits§

RouterDestination
A navigation destination produced automatically by the #[shard] macro.