pub struct Router { /* private fields */ }
Implementations§
Source§impl Router
impl Router
Sourcepub fn try_init(defualt_dest: impl RouterDestination + 'static) -> bool
pub fn try_init(defualt_dest: impl RouterDestination + 'static) -> bool
Initialize the router with a default destination if not already done.
Sourcepub fn with_mut<F, R>(f: F) -> Rwhere
F: FnOnce(&mut Self) -> R,
pub fn with_mut<F, R>(f: F) -> Rwhere
F: FnOnce(&mut Self) -> R,
Execute a closure with exclusive mutable access to the router.
Sourcepub fn with<F, R>(f: F) -> Rwhere
F: FnOnce(&Self) -> R,
pub fn with<F, R>(f: F) -> Rwhere
F: FnOnce(&Self) -> R,
Execute a closure with shared read access to the router.
Sourcepub fn push<T: RouterDestination + 'static>(&mut self, destination: T)
pub fn push<T: RouterDestination + 'static>(&mut self, destination: T)
Push a new route destination onto the stack (internal helper).
Sourcepub fn pop(&mut self) -> Option<Box<dyn RouterDestination>>
pub fn pop(&mut self) -> Option<Box<dyn RouterDestination>>
Pop the top route destination from the stack.
Returns None
if the stack is empty.
Sourcepub fn last(&self) -> Option<&dyn RouterDestination>
pub fn last(&self) -> Option<&dyn RouterDestination>
Get the current top route destination, used for route component display.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Clear all routes from the stack and reset initialization state.
This allows the root destination to be initialized again.
Sourcepub fn reset_with(&mut self, root_dest: impl RouterDestination + 'static)
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> 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
Mutably borrows from an owned value. Read more