Explorar o código

rename generic navigator to navigator

Evan Almloff hai 1 ano
pai
achega
cc94711d62

+ 2 - 2
packages/router/src/contexts/navigator.rs

@@ -2,9 +2,9 @@ use crate::prelude::{ExternalNavigationFailure, IntoRoutable, RouterContext};
 
 /// A view into the navigation state of a router.
 #[derive(Clone)]
-pub struct GenericNavigator(pub(crate) RouterContext);
+pub struct Navigator(pub(crate) RouterContext);
 
-impl GenericNavigator {
+impl Navigator {
     /// Check whether there is a previous page to navigate back to.
     #[must_use]
     pub fn can_go_back(&self) -> bool {

+ 3 - 3
packages/router/src/hooks/use_navigator.rs

@@ -1,6 +1,6 @@
 use dioxus::prelude::ScopeState;
 
-use crate::prelude::{GenericNavigator, RouterContext};
+use crate::prelude::{Navigator, RouterContext};
 
 /// A hook that provides access to the navigator to change the router history. Unlike [`use_router`], this hook will not cause a rerender when the current route changes
 ///
@@ -47,12 +47,12 @@ use crate::prelude::{GenericNavigator, RouterContext};
 /// # let mut vdom = VirtualDom::new(App);
 /// # let _ = vdom.rebuild();
 /// ```
-pub fn use_navigator(cx: &ScopeState) -> &GenericNavigator {
+pub fn use_navigator(cx: &ScopeState) -> &Navigator {
     &*cx.use_hook(|| {
         let router = cx
             .consume_context::<RouterContext>()
             .expect("Must be called in a descendant of a Router component");
 
-        GenericNavigator(router)
+        Navigator(router)
     })
 }