Struct perseus::router::RouterState
source · pub struct RouterState { /* private fields */ }
Expand description
The state for the router. This makes use of RcSignal
s internally, and can
be cheaply cloned.
Implementations§
source§impl RouterState
impl RouterState
sourcepub fn get_load_state<'a>(&self, cx: Scope<'a>) -> &'a RcSignal<RouterLoadState>
pub fn get_load_state<'a>(&self, cx: Scope<'a>) -> &'a RcSignal<RouterLoadState>
Gets the load state of the router. You’ll still need to call .get()
after this (this just returns a &'a RcSignal
to derive other state
from in a create_memo
or the like).
sourcepub fn get_last_verdict(&self) -> Option<RouteVerdict>
pub fn get_last_verdict(&self) -> Option<RouteVerdict>
Gets the last verdict.
sourcepub fn reload(&self)
pub fn reload(&self)
Orders the router to reload the current page as if you’d called
navigate()
to it (but that would do nothing). This
enables reloading in an SPA style (but you should almost never need it).
Warning: if you’re trying to rest your app, do NOT use this! Instead,
reload the page fully through web_sys
.
sourcepub fn get_path(&self) -> Option<PathMaybeWithLocale>
pub fn get_path(&self) -> Option<PathMaybeWithLocale>
Gets the current path within the app, including the locale if the app is using i18n. This will not have a leading/trailing forward slash.
If you’re executing this from within a page, it will always be
Some(..)
. None
will be returned if no page has been rendered yet
(if you managed to call this from a plugin…), or, more likely, if
an error occurred (i.e. this will probably be None
in error pages,
which are given the path anyway), or if we’re diverting to a
localized version of the current path (in which case
your code should not be running).
Trait Implementations§
source§impl Clone for RouterState
impl Clone for RouterState
source§fn clone(&self) -> RouterState
fn clone(&self) -> RouterState
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more