Skip to main content

tessera_shard/router/
destination.rs

1use std::{any::Any, sync::Arc};
2
3use tessera_ui::State;
4
5use super::RouterController;
6
7/// A navigation destination produced by the `#[shard]` macro.
8pub trait RouterDestination: Any + Send + Sync {
9    /// Execute the component associated with this destination.
10    fn exec_component(&self, controller: State<RouterController>);
11
12    /// Copies the component entry point so it can run without borrowing `self`.
13    fn exec_component_handle(&self) -> Arc<dyn Fn(State<RouterController>) + Send + Sync>;
14
15    /// Stable destination identifier used for route identity checks.
16    fn destination_id() -> &'static str
17    where
18        Self: Sized;
19}