pub struct Navigator;Expand description
Navigation API for convenient route navigation.
Provides static methods for navigation operations:
Navigator::push(cx, "/path")— Navigate to a new pageNavigator::pop(cx)— Go back to previous pageNavigator::replace(cx, "/path")— Replace current page
All navigation methods run the full pipeline (guards, middleware).
§Example
use gpui_navigator::Navigator;
Navigator::push(cx, "/users/123");
Navigator::pop(cx);
Navigator::replace(cx, "/login");Implementations§
Sourcepub fn of<C: BorrowAppContext + BorrowMut<App>>(
cx: &mut C,
) -> NavigatorHandle<'_, C>
pub fn of<C: BorrowAppContext + BorrowMut<App>>( cx: &mut C, ) -> NavigatorHandle<'_, C>
Get a NavigatorHandle for chained navigation calls.
Sourcepub fn push(
cx: &mut (impl BorrowAppContext + BorrowMut<App>),
route: impl IntoRoute,
)
pub fn push( cx: &mut (impl BorrowAppContext + BorrowMut<App>), route: impl IntoRoute, )
Navigate to a new path.
Sourcepub fn replace(
cx: &mut (impl BorrowAppContext + BorrowMut<App>),
route: impl IntoRoute,
)
pub fn replace( cx: &mut (impl BorrowAppContext + BorrowMut<App>), route: impl IntoRoute, )
Replace current path without adding to history.
Sourcepub fn push_with_state(
cx: &mut (impl BorrowAppContext + BorrowMut<App>),
route: impl IntoRoute,
state: HistoryState,
)
pub fn push_with_state( cx: &mut (impl BorrowAppContext + BorrowMut<App>), route: impl IntoRoute, state: HistoryState, )
Push a new path with associated HistoryState data.
Sourcepub fn replace_with_state(
cx: &mut (impl BorrowAppContext + BorrowMut<App>),
route: impl IntoRoute,
state: HistoryState,
)
pub fn replace_with_state( cx: &mut (impl BorrowAppContext + BorrowMut<App>), route: impl IntoRoute, state: HistoryState, )
Replace current path with associated HistoryState data.
Sourcepub fn current_entry(cx: &App) -> HistoryEntry
pub fn current_entry(cx: &App) -> HistoryEntry
Return the current HistoryEntry (path + optional state).
Sourcepub fn pop(cx: &mut (impl BorrowAppContext + BorrowMut<App>))
pub fn pop(cx: &mut (impl BorrowAppContext + BorrowMut<App>))
Go back to the previous route.
Sourcepub fn forward(cx: &mut (impl BorrowAppContext + BorrowMut<App>))
pub fn forward(cx: &mut (impl BorrowAppContext + BorrowMut<App>))
Go forward in history.
Sourcepub fn current_path(cx: &App) -> String
pub fn current_path(cx: &App) -> String
Get current path.
Sourcepub fn can_go_back(cx: &App) -> bool
pub fn can_go_back(cx: &App) -> bool
Alias for can_pop.
Sourcepub fn can_go_forward(cx: &App) -> bool
pub fn can_go_forward(cx: &App) -> bool
Check if can go forward.
Sourcepub fn push_named(
cx: &mut (impl BorrowAppContext + BorrowMut<App>),
name: &str,
params: &RouteParams,
)
pub fn push_named( cx: &mut (impl BorrowAppContext + BorrowMut<App>), name: &str, params: &RouteParams, )
Navigate to a named route with parameters.
Sourcepub fn url_for(cx: &App, name: &str, params: &RouteParams) -> Option<String>
pub fn url_for(cx: &App, name: &str, params: &RouteParams) -> Option<String>
Generate URL for a named route.
Sourcepub fn set_next_transition(
cx: &mut impl BorrowAppContext,
transition: Transition,
)
Available on crate feature transition only.
pub fn set_next_transition( cx: &mut impl BorrowAppContext, transition: Transition, )
transition only.Set transition for the next navigation.
Sourcepub fn push_with_transition(
cx: &mut (impl BorrowAppContext + BorrowMut<App>),
route: impl IntoRoute,
transition: Transition,
)
Available on crate feature transition only.
pub fn push_with_transition( cx: &mut (impl BorrowAppContext + BorrowMut<App>), route: impl IntoRoute, transition: Transition, )
transition only.Navigate with a specific transition.
Sourcepub fn replace_with_transition(
cx: &mut (impl BorrowAppContext + BorrowMut<App>),
route: impl IntoRoute,
transition: Transition,
)
Available on crate feature transition only.
pub fn replace_with_transition( cx: &mut (impl BorrowAppContext + BorrowMut<App>), route: impl IntoRoute, transition: Transition, )
transition only.Replace with a specific transition.
Sourcepub fn push_named_with_transition(
cx: &mut (impl BorrowAppContext + BorrowMut<App>),
name: &str,
params: &RouteParams,
transition: Transition,
)
Available on crate feature transition only.
pub fn push_named_with_transition( cx: &mut (impl BorrowAppContext + BorrowMut<App>), name: &str, params: &RouteParams, transition: Transition, )
transition only.Push named route with a specific transition.
Auto Trait Implementations§
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
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>
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>
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)
&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)
&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>
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