pub struct RouterController { /* private fields */ }Expand description
Reactive navigation controller for one shard tree.
Implementations§
Source§impl RouterController
impl RouterController
Sourcepub fn with_root(root_dest: impl RouterDestination + 'static) -> Self
pub fn with_root(root_dest: impl RouterDestination + 'static) -> Self
Create a controller seeded with a root destination.
Create a controller seeded with a shared root destination.
Sourcepub fn push<T: RouterDestination + 'static>(&mut self, destination: T)
pub fn push<T: RouterDestination + 'static>(&mut self, destination: T)
Push a destination onto the stack.
Push a shared destination onto the stack.
Sourcepub fn pop(&mut self) -> Option<Arc<dyn RouterDestination>>
pub fn pop(&mut self) -> Option<Arc<dyn RouterDestination>>
Pop the top destination from the stack.
Returns None if the stack is empty.
Sourcepub fn replace<T: RouterDestination + 'static>(
&mut self,
destination: T,
) -> Option<Arc<dyn RouterDestination>>
pub fn replace<T: RouterDestination + 'static>( &mut self, destination: T, ) -> Option<Arc<dyn RouterDestination>>
Replace the top destination.
If the stack is empty, this behaves like Self::push.
Replace the top destination with a shared destination.
Sourcepub fn last(&self) -> Option<&dyn RouterDestination>
pub fn last(&self) -> Option<&dyn RouterDestination>
Top destination.
Sourcepub fn exec_current(&self) -> bool
pub fn exec_current(&self) -> bool
Execute the top destination.
Returns false when the stack is empty.
Sourcepub fn init_or_get<T, F, R>(&self, id: &str, f: F) -> R
pub fn init_or_get<T, F, R>(&self, id: &str, f: F) -> R
Get or initialize route-scoped state and provide it to f.
Sourcepub fn init_or_get_with_lifecycle<T, F, R>(
&self,
id: &str,
life_cycle: ShardStateLifeCycle,
f: F,
) -> R
pub fn init_or_get_with_lifecycle<T, F, R>( &self, id: &str, life_cycle: ShardStateLifeCycle, f: F, ) -> R
Get or initialize state for a lifecycle scope and provide it to f.
Sourcepub fn reset(&mut self, root_dest: impl RouterDestination + 'static)
pub fn reset(&mut self, root_dest: impl RouterDestination + 'static)
Clear all destinations and push a new root destination.
Clear all destinations and push a shared root destination.