pub struct RouteNavigator { /* private fields */ }Expand description
The declarative router vocabulary (a go_router-subset layer),
flat-re-exported from frust-widgets so app code never names that
crate directly: Router resolves a location against a Route table
(built via RouteBuilder) into Resolution/ResolvedPages driving
a NavigatorController, with :param/query parsing
(Location/PathPattern/RouteParams), per-route/top-level
Redirects (loop-guarded at DEFAULT_REDIRECT_LIMIT), and an
ErrorBuilder fallback for an unmatched location.
A page builder receives the location’s query merged under its path
captures, so /terminal?session=abc reads its own parameter.
RouteNavigator is the seam a screen navigates through: a Send + Sync
queue of NavRequest data (paths and names, never closures) that rides
provide_context — the Router itself cannot, since it holds Rc page
builders. RouterDeepLinks::track drains it every rebuild, so a request
queued in an event handler (on any thread — the queue never panics
off-thread) applies on the next frame.
shell_route is the nested-navigator binding: its children resolve onto a
second NavigatorController the app owns and its own page — the chrome
wrapping that inner navigator — stays retained while they do, so navigating
between siblings inside the shell never rebuilds the chrome. See its docs
for the keep rule and the per-verb table.
The context-reachable navigation handle: Send + Sync + 'static, cheap to
clone (one Arc), and safe to hold in app state, in a callback, or under
provide_context. See the module docs for why it carries data
instead of a router reference.
Obtain one from
Router::route_navigator; the
router it came from applies whatever is queued on its next
pump.
Implementations§
Sourcepub fn new() -> RouteNavigator
pub fn new() -> RouteNavigator
A fresh, empty navigator with no waker installed. Apps get one from
Router::route_navigator
rather than constructing it directly.
Sourcepub fn request(&self, request: NavRequest)
pub fn request(&self, request: NavRequest)
Queue request and fire the waker. The single append path every
convenience method below routes through.
Sourcepub fn go(&self, location: impl Into<String>)
pub fn go(&self, location: impl Into<String>)
Queue a NavRequest::Go — reset the stack to location’s chain.
Sourcepub fn push(&self, location: impl Into<String>)
pub fn push(&self, location: impl Into<String>)
Queue a NavRequest::Push — stack location’s leaf page.
Sourcepub fn replace(&self, location: impl Into<String>)
pub fn replace(&self, location: impl Into<String>)
Queue a NavRequest::Replace — swap the top page for location’s
leaf.
Sourcepub fn pop(&self)
pub fn pop(&self)
Queue a NavRequest::Pop.
Sourcepub fn go_named(
&self,
name: impl Into<String>,
params: BTreeMap<String, String>,
)
pub fn go_named( &self, name: impl Into<String>, params: BTreeMap<String, String>, )
Queue a NavRequest::GoNamed.
Sourcepub fn push_named(
&self,
name: impl Into<String>,
params: BTreeMap<String, String>,
)
pub fn push_named( &self, name: impl Into<String>, params: BTreeMap<String, String>, )
Queue a NavRequest::PushNamed.
Sourcepub fn set_waker(&self, waker: Arc<dyn Fn() + Sync + Send>)
pub fn set_waker(&self, waker: Arc<dyn Fn() + Sync + Send>)
Install the “wake the shell” callback fired after every append. The
facade installs ReactiveRuntime::wake when it wires the router; a
navigator with no waker still queues correctly, it just relies on
something else to schedule the next frame.
Sourcepub fn drain(&self) -> Vec<NavRequest>
pub fn drain(&self) -> Vec<NavRequest>
Take every queued request in append order, leaving the queue empty.
Router::pump is the only caller in
normal use.
Trait Implementations§
Source§fn clone(&self) -> RouteNavigator
fn clone(&self) -> RouteNavigator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§fn default() -> RouteNavigator
fn default() -> RouteNavigator
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.