Router

Struct Router 

Source
pub struct Router { /* private fields */ }

Implementations§

Source§

impl Router

Source

pub fn try_init(defualt_dest: impl RouterDestination + 'static) -> bool

Initialize the router with a default destination if not already done.

Source

pub fn with_mut<F, R>(f: F) -> R
where F: FnOnce(&mut Self) -> R,

Execute a closure with exclusive mutable access to the router.

Source

pub fn with<F, R>(f: F) -> R
where F: FnOnce(&Self) -> R,

Execute a closure with shared read access to the router.

Source

pub fn push<T: RouterDestination + 'static>(&mut self, destination: T)

Push a new route destination onto the stack (internal helper).

Source

pub fn pop(&mut self) -> Option<Box<dyn RouterDestination>>

Pop the top route destination from the stack.

Returns None if the stack is empty.

Source

pub fn is_empty(&self) -> bool

Whether the router is empty.

Source

pub fn last(&self) -> Option<&dyn RouterDestination>

Get the current top route destination, used for route component display.

Source

pub fn len(&self) -> usize

Get the length of the route stack.

Source

pub fn clear(&mut self)

Clear all routes from the stack.

Source

pub fn reset(&mut self)

Clear all routes from the stack and reset initialization state.

This allows the root destination to be initialized again.

Source

pub fn reset_with(&mut self, root_dest: impl RouterDestination + 'static)

Clear all routes from the stack and push a new root destination.

Auto Trait Implementations§

§

impl Freeze for Router

§

impl !RefUnwindSafe for Router

§

impl Send for Router

§

impl Sync for Router

§

impl Unpin for Router

§

impl !UnwindSafe for Router

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, 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.