pub trait NavStackBuilder<K: Route>: Sized {
// Required methods
fn title<M>(self, t: impl IntoText<M>) -> Self;
fn toolbar<M>(self, content: impl ToolbarContent<M>) -> Self;
fn destination<P: Piece>(self, build: impl Fn(&K) -> P + 'static) -> Self;
fn on_back(
self,
guard: impl Fn(BackRequest) -> BackResponse + 'static,
) -> Self;
fn restore(self, key: impl Into<String>) -> Self;
}Expand description
Required Methods§
fn title<M>(self, t: impl IntoText<M>) -> Self
Sourcefn toolbar<M>(self, content: impl ToolbarContent<M>) -> Self
fn toolbar<M>(self, content: impl ToolbarContent<M>) -> Self
Declare toolbar items on this stack’s root page chrome (docs/toolbars.md): the commands that act on what the root shows, and that have nothing to act on once a pushed page covers it. A pushed page declares its own with the same method on the piece it builds.
Takes one item, a list of them, or a closure that derives the list.
Sourcefn destination<P: Piece>(self, build: impl Fn(&K) -> P + 'static) -> Self
fn destination<P: Piece>(self, build: impl Fn(&K) -> P + 'static) -> Self
Build the view for a pushed key (&String for raw keys, the typed value otherwise).
Sourcefn on_back(self, guard: impl Fn(BackRequest) -> BackResponse + 'static) -> Self
fn on_back(self, guard: impl Fn(BackRequest) -> BackResponse + 'static) -> Self
Intercept the back affordance (docs/navigation.md). The guard runs for every native back
gesture/button and nav_back while the stack is above its root; it returns
BackResponse::Proceed to pop now or BackResponse::Handled to consume the back
(stash the BackRequest and call BackRequest::proceed later). Programmatic path
writes are never guarded. While a guard is armed the toolkit stops auto-popping on a
native gesture and routes the back through Day instead (NavPatch::GuardTop).
Sourcefn restore(self, key: impl Into<String>) -> Self
fn restore(self, key: impl Into<String>) -> Self
Remember the pushed path across launches (docs/navigation.md). On every change the path’s
keys are /-joined and saved under key; at build the saved path is parsed back (each
segment via Route::from_key) and restored, so the app reopens exactly where the user
left off, including after an Android process death, unless a launch deep link is pending,
which wins. day::launch installs the preferences as the store (docs/navigation.md); a
saved path with a segment that no longer parses is ignored whole.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".