pub struct NavigatorView<State>where
State: 'static,{ /* private fields */ }Expand description
A declarative navigator. See the module docs.
Implementations§
Sourcepub fn transition(self, spec: TransitionSpec) -> NavigatorView<State>
pub fn transition(self, spec: TransitionSpec) -> NavigatorView<State>
Set the default page transition applied to every push/replace that does
not carry its own push_with/
replace_with override.
Sourcepub fn pop_swipe(self, enabled: bool) -> NavigatorView<State>
pub fn pop_swipe(self, enabled: bool) -> NavigatorView<State>
Explicitly enable or disable the interactive edge-swipe back gesture,
outranking both platform_pop_swipe and the
preset-derived default (on for PageTransition::IosPush, off
otherwise). The gesture pops the top page with a left-edge drag: drag
progress reverses the popped page’s transition, and release completes
or cancels the pop by progress/velocity. A page may still narrow this
further with PushOptions::pop_swipe (the highest-ranked slot) or
refuse it outright via a non-Pop BackPolicy (see
NavigatorWidget::swipe_armable).
Sourcepub fn platform_pop_swipe(self, enabled: bool) -> NavigatorView<State>
pub fn platform_pop_swipe(self, enabled: bool) -> NavigatorView<State>
Set the platform-derived edge-swipe default — ranked below an explicit
pop_swipe override and above the preset-derived
fallback. frust-widgets carries no cfg(target_os) of its own; this
is the plain setter the facade calls (crates/frust/src/lib.rs) with
cfg!(target_os = "ios"), so an app using frust::navigator gets an
iOS-on / Android-and-desktop-off default with zero app-side wiring.
Sourcepub fn on_root_visibility(
self,
f: impl Fn(PageVisibility) + 'static,
) -> NavigatorView<State>
pub fn on_root_visibility( self, f: impl Fn(PageVisibility) + 'static, ) -> NavigatorView<State>
Observe the root page’s PageVisibility — the same seam
PushOptions::on_visibility gives a pushed page, for the one page that
has no PushOptions. Fired once with
Current on the navigator’s first build, then
on every change (e.g. Covered when an opaque
page is pushed over it).
Read PushOptions::on_visibility’s doc for the full contract: no
&mut State, no duplicate values, and — importantly — no on_cleanup
on cover; the root page stays mounted with its widget state intact.
The callback is captured at the navigator’s first build (like the root
page’s builder itself) and is not refreshed on later rebuilds.
Sourcepub fn cull_covered_builds(self, enabled: bool) -> NavigatorView<State>
pub fn cull_covered_builds(self, enabled: bool) -> NavigatorView<State>
Skip re-running the builder (and the child reconcile) for pages that are
Covered.
Default false — the shipped behaviour, where every retained page
reconciles every frame whether covered or not. Making covered builds stop
is a real behaviour change (an app may rely on a covered page’s builder
running against live state), so it is strictly opt-in.
Two ordering rules hold when enabled, and neither needs a wake mechanism:
- A revealed page rebuilds in the same pass that revealed it. Ops are
applied — and a settled transition finalized — before the per-page
reconcile loop in
NavigatorView::rebuild, so by the time the loop asksvisibility_ofthe revealed page is no longerCovered. There is no cross-frame gap to bridge. - The frame on which a page becomes
Coveredstill rebuilds it. The cull decision reads the page’s visibility as of the previous reconcile, so a page gets exactly one final reconcile after itson_visibility(Covered)fires — a page staging teardown UI on cover can still render it.
Sourcepub fn root_route(self, location: Location) -> NavigatorView<State>
pub fn root_route(self, location: Location) -> NavigatorView<State>
Stamp the ROOT page’s route identity — see
PushOptions::route, the pushed-page equivalent.
Sourcepub fn on_route_change(
self,
f: impl Fn(&RouteStack) + 'static,
) -> NavigatorView<State>
pub fn on_route_change( self, f: impl Fn(&RouteStack) + 'static, ) -> NavigatorView<State>
Observe this navigator’s route-state, navigator-wide: fired from
NavigatorWidget::publish_state only when the published
RouteStack actually changes (an unchanged stack across N rebuilds
fires it zero times) — never with &mut State (it fires from a
rebuild), exactly like PushOptions::on_visibility’s contract. The
facade’s reactive route-observer bridges this into signals (see
docs/WIDGETS_ARCHITECTURE.md’s reactive-free note): capture a plain
Rc<Cell<_>> here, don’t reach for app state.
Trait Implementations§
Source§type Element = NavigatorWidget<State>
type Element = NavigatorWidget<State>
Source§fn build(&self, ctx: &mut BuildCtx<'_>) -> NavigatorWidget<State>
fn build(&self, ctx: &mut BuildCtx<'_>) -> NavigatorWidget<State>
Source§fn rebuild(
&self,
_prev: &NavigatorView<State>,
element: &mut NavigatorWidget<State>,
ctx: &mut BuildCtx<'_>,
) -> ChangeFlags
fn rebuild( &self, _prev: &NavigatorView<State>, element: &mut NavigatorWidget<State>, ctx: &mut BuildCtx<'_>, ) -> ChangeFlags
prev (the previous view of the same type) against the live
element, mutating it in place and reporting what changed.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> 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.