pub struct RouterController { /* private fields */ }Expand description
Reactive navigation controller for one shard tree.
Implementations§
Source§impl RouterController
impl RouterController
Sourcepub fn new() -> RouterController
pub fn new() -> RouterController
Create an empty controller.
Sourcepub fn with_root(
root_dest: impl RouterDestination + 'static,
) -> RouterController
pub fn with_root( root_dest: impl RouterDestination + 'static, ) -> RouterController
Create a controller seeded with a root destination.
Create a controller seeded with a shared root destination.
Sourcepub fn push<T>(&mut self, destination: T)where
T: RouterDestination + 'static,
pub fn push<T>(&mut self, destination: T)where
T: RouterDestination + 'static,
Push a destination onto the stack.
Push a shared destination onto the stack.
Sourcepub fn pop(&mut self) -> Option<Arc<dyn RouterDestination>>
pub fn pop(&mut self) -> Option<Arc<dyn RouterDestination>>
Pop the top destination from the stack.
Returns None if the stack is empty.
Sourcepub fn replace<T>(
&mut self,
destination: T,
) -> Option<Arc<dyn RouterDestination>>where
T: RouterDestination + 'static,
pub fn replace<T>(
&mut self,
destination: T,
) -> Option<Arc<dyn RouterDestination>>where
T: RouterDestination + 'static,
Replace the top destination.
If the stack is empty, this behaves like Self::push.
Replace the top destination with a shared destination.
Sourcepub fn last(&self) -> Option<&dyn RouterDestination>
pub fn last(&self) -> Option<&dyn RouterDestination>
Top destination.
Sourcepub fn exec_current(&self) -> bool
pub fn exec_current(&self) -> bool
Execute the top destination.
Returns false when the stack is empty.
Sourcepub fn init_or_get<T, F, R>(&self, id: &str, f: F) -> R
pub fn init_or_get<T, F, R>(&self, id: &str, f: F) -> R
Get or initialize route-scoped state and provide it to f.
Sourcepub fn init_or_get_with_lifecycle<T, F, R>(
&self,
id: &str,
life_cycle: ShardStateLifeCycle,
f: F,
) -> R
pub fn init_or_get_with_lifecycle<T, F, R>( &self, id: &str, life_cycle: ShardStateLifeCycle, f: F, ) -> R
Get or initialize state for a lifecycle scope and provide it to f.
Sourcepub fn reset(&mut self, root_dest: impl RouterDestination + 'static)
pub fn reset(&mut self, root_dest: impl RouterDestination + 'static)
Clear all destinations and push a new root destination.
Clear all destinations and push a shared root destination.
Trait Implementations§
Source§impl Default for RouterController
impl Default for RouterController
Source§fn default() -> RouterController
fn default() -> RouterController
Auto Trait Implementations§
impl Freeze for RouterController
impl !RefUnwindSafe for RouterController
impl Send for RouterController
impl Sync for RouterController
impl Unpin for RouterController
impl !UnwindSafe for RouterController
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§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>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§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.§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.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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