update doc examples

This commit is contained in:
Evan Almloff committed 2023-05-31 15:51:26 -05:00
1 parent 35befa1784
commit 09cabe4e8b
22 files changed
+474 -518

No files matched your search

+2 -2
View File
@@ -1,6 +1,6 @@
use dioxus::prelude::*;
use crate::{hooks::use_route, routable::Routable};
use crate::{hooks::use_generic_route, routable::Routable};
#[derive(Clone)]
pub(crate) struct OutletContext {
@@ -25,7 +25,7 @@ impl OutletContext {
}
});
use_route::<R>(cx)
use_generic_route::<R>(cx)
.expect("Outlet must be inside of a router")
.render(cx, current_level)
}
+6 -4
View File
@@ -149,7 +149,8 @@ where
/// Push a new location.
///
/// The previous location will be available to go back to.
pub fn push(&self, target: NavigationTarget<R>) -> Option<NavigationFailure<R>> {
pub fn push(&self, target: impl Into<NavigationTarget<R>>) -> Option<NavigationFailure<R>> {
let target = target.into();
let mut state = self.state_mut();
match target {
NavigationTarget::Internal(p) => state.history.push(p),
@@ -163,7 +164,8 @@ where
/// Replace the current location.
///
/// The previous location will **not** be available to go back to.
pub fn replace(&self, target: NavigationTarget<R>) -> Option<NavigationFailure<R>> {
pub fn replace(&self, target: impl Into<NavigationTarget<R>>) -> Option<NavigationFailure<R>> {
let target = target.into();
let mut state = self.state_mut();
match target {
NavigationTarget::Internal(p) => state.history.replace(p),
@@ -264,7 +266,7 @@ where
// struct TestHistory {}
// impl HistoryProvider for TestHistory {
// fn current_path(&self) -> String {
// fn current_route(&self) -> String {
// todo!()
// }
@@ -758,7 +760,7 @@ where
// struct TestHistory {}
// impl HistoryProvider for TestHistory {
// fn current_path(&self) -> String {
// fn current_route(&self) -> String {
// String::from("/")
// }