fix external router examples
This commit is contained in:
1 parent
45a004bf74
commit
07446386e6
7 files changed
+157
-133
No files matched your search
@@ -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()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user