fix external router examples

This commit is contained in:
Evan Almloff committed 2023-06-01 14:10:33 -05:00
1 parent 45a004bf74
commit 07446386e6
7 files changed
+157 -133

No files matched your search

+5 -7
View File
@@ -33,17 +33,15 @@ where
/// OtherPage {},
/// }
///
/// let mut history = MemoryHistory::<Route>::with_initial_path("/").unwrap();
/// let mut history = MemoryHistory::<Route>::with_initial_path(Route::Index {}).unwrap();
/// assert_eq!(history.current_route(), Route::Index {});
/// assert_eq!(history.can_go_back(), false);
/// ```
pub fn with_initial_path(path: impl AsRef<str>) -> Result<Self, <R as FromStr>::Err> {
let path = path.as_ref();
Ok(Self {
current: R::from_str(path)?,
pub fn with_initial_path(path: R) -> Self {
Self {
current: path,
..Default::default()
})
}
}
}