pub struct RouterController { /* private fields */ }Expand description
Owns the destination stack and reactive state for its routes.
Implementations§
Source§impl RouterController
impl RouterController
Sourcepub fn with_root(root_dest: impl RouterDestination + 'static) -> Self
pub fn with_root(root_dest: impl RouterDestination + 'static) -> Self
Creates a controller seeded with a root destination.
Creates a controller seeded with a shared root destination.
Sourcepub fn push<T: RouterDestination + 'static>(&mut self, destination: T)
pub fn push<T: RouterDestination + 'static>(&mut self, destination: T)
Pushes a destination with its own state lifetime.
Pushes a shared destination with its own state lifetime.
Sourcepub fn pop(&mut self) -> Option<Arc<dyn RouterDestination>>
pub fn pop(&mut self) -> Option<Arc<dyn RouterDestination>>
Pops the current destination and releases its route state.
Sourcepub fn replace<T: RouterDestination + 'static>(
&mut self,
destination: T,
) -> Option<Arc<dyn RouterDestination>>
pub fn replace<T: RouterDestination + 'static>( &mut self, destination: T, ) -> Option<Arc<dyn RouterDestination>>
Replaces the current destination, or pushes into an empty stack.
Replaces the current destination with a shared destination.
Sourcepub fn last(&self) -> Option<&dyn RouterDestination>
pub fn last(&self) -> Option<&dyn RouterDestination>
Returns the current destination.
Sourcepub fn current_is<D: RouterDestination + 'static>(&self) -> bool
pub fn current_is<D: RouterDestination + 'static>(&self) -> bool
Returns whether the current destination has type D.
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
Gets or initializes state owned by the current route.
Sourcepub fn init_or_get_with_lifecycle<T, F, R>(
&self,
id: &str,
lifecycle: ShardStateLifeCycle,
f: F,
) -> R
pub fn init_or_get_with_lifecycle<T, F, R>( &self, id: &str, lifecycle: ShardStateLifeCycle, f: F, ) -> R
Gets or initializes state owned by a route or this controller.
Sourcepub fn reset(&mut self, root_dest: impl RouterDestination + 'static)
pub fn reset(&mut self, root_dest: impl RouterDestination + 'static)
Clears the stack and installs a new root destination.
Clears the stack and installs a shared root destination.
Trait Implementations§
Source§impl Default for RouterController
impl Default for RouterController
Source§impl Drop for RouterController
impl Drop for RouterController
Auto Trait Implementations§
impl !RefUnwindSafe for RouterController
impl !UnwindSafe for RouterController
impl Freeze for RouterController
impl Send for RouterController
impl Sync for RouterController
impl Unpin for RouterController
impl UnsafeUnpin 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§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.