Skip to main content

NavController

Struct NavController 

Source
pub struct NavController {
    pub push: Box<dyn Fn(&str) -> bool>,
    pub pop: Box<dyn Fn(bool) -> bool>,
    pub current: Box<dyn Fn() -> String>,
    pub enter: Box<dyn Fn(&str) -> bool>,
    pub segments: Box<dyn Fn() -> Vec<String>>,
}
Expand description

A mounted host’s control surface. Closures run user code (route builders), so the registry NEVER holds a borrow across a call (§3.3 discipline: clone the Rc out, then call).

Fields§

§push: Box<dyn Fn(&str) -> bool>

Push (or, in split/tab presentation, select) a registered route. False = unknown route.

§pop: Box<dyn Fn(bool) -> bool>

Pop the top route. already_popped = the native side popped first (iOS back). False = nothing to pop (tabs hosts always return false: they have no stack).

§current: Box<dyn Fn() -> String>

Current route path (“” while showing the root).

§enter: Box<dyn Fn(&str) -> bool>

Consume one segment of an ABSOLUTE path. Selectors/tabs accept a declared key (same as push); a stack accepts ANY segment by pushing it (its destinations are open-ended). Distinct from push so a relative navigate("key") can still fall through a stack.

§segments: Box<dyn Fn() -> Vec<String>>

This surface’s contribution to the full route: [] at root, [key] for a selector / tabs, the whole path for a stack.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> ErasedDestructor for T
where T: 'static,

Day API ↩ Guides· daybrite.dev