pub struct RouterState {
pub location: Location,
pub path_match: Option<PathMatch>,
pub params: HashMap<SharedString, SharedString>,
}
Expand description
The global state of the router, including the current location, path match, and parameters. This state is stored globally within the GPUI application context.
Fields§
§location: Location
The current location in the router.
path_match: Option<PathMatch>
The path match information for the current location.
params: HashMap<SharedString, SharedString>
The dynamic parameters for the current location.
Implementations§
Source§impl RouterState
impl RouterState
Sourcepub fn init(cx: &mut App)
pub fn init(cx: &mut App)
Initializes the RouterState within the GPUI application context. This function sets up the initial state of the router.
Sourcepub fn with_path(&mut self, pathname: SharedString) -> &mut Self
pub fn with_path(&mut self, pathname: SharedString) -> &mut Self
Sets the current pathname in the router state.
Sourcepub fn global(cx: &App) -> &Self
pub fn global(cx: &App) -> &Self
Retrieves an immutable reference to the global RouterState from the GPUI application context.
Sourcepub fn global_mut(cx: &mut App) -> &mut Self
pub fn global_mut(cx: &mut App) -> &mut Self
Retrieves a mutable reference to the global RouterState from the GPUI application context.
Trait Implementations§
Source§impl Clone for RouterState
impl Clone for RouterState
Source§fn clone(&self) -> RouterState
fn clone(&self) -> RouterState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl PartialEq for RouterState
impl PartialEq for RouterState
impl Global for RouterState
impl StructuralPartialEq for RouterState
Auto Trait Implementations§
impl Freeze for RouterState
impl RefUnwindSafe for RouterState
impl Send for RouterState
impl Sync for RouterState
impl Unpin for RouterState
impl UnwindSafe for RouterState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
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
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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 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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ReadGlobal for Twhere
T: Global,
impl<T> ReadGlobal for Twhere
T: Global,
Source§impl<T> UpdateGlobal for Twhere
T: Global,
impl<T> UpdateGlobal for Twhere
T: Global,
Source§fn update_global<C, F, R>(cx: &mut C, update: F) -> R
fn update_global<C, F, R>(cx: &mut C, update: F) -> R
Updates the global instance of the implementing type using the provided closure. Read more
Source§fn set_global<C>(cx: &mut C, global: T)where
C: BorrowAppContext,
fn set_global<C>(cx: &mut C, global: T)where
C: BorrowAppContext,
Set the global instance of the implementing type.