pub struct MemoryHistory { /* private fields */ }
Expand description
A History
provider that stores all navigation information in memory.
Implementations§
Source§impl MemoryHistory
impl MemoryHistory
Sourcepub fn with_initial_path(path: impl ToString) -> Self
pub fn with_initial_path(path: impl ToString) -> Self
Create a MemoryHistory
starting at path
.
#[derive(Clone, Routable, Debug, PartialEq)]
enum Route {
#[route("/")]
Index {},
#[route("/some-other-page")]
OtherPage {},
}
let mut history = dioxus_history::MemoryHistory::with_initial_path(Route::Index {});
assert_eq!(history.current_route(), Route::Index {}.to_string());
assert_eq!(history.can_go_back(), false);
Sourcepub fn with_prefix(self, prefix: impl ToString) -> Self
pub fn with_prefix(self, prefix: impl ToString) -> Self
Set the base path for the history. All routes will be prefixed with this path when rendered.
let mut history = MemoryHistory::default().with_prefix("/my-app");
// The base path is set to "/my-app"
assert_eq!(history.current_prefix(), Some("/my-app".to_string()));
Trait Implementations§
Source§impl Default for MemoryHistory
impl Default for MemoryHistory
Source§impl History for MemoryHistory
impl History for MemoryHistory
Source§fn current_route(&self) -> String
fn current_route(&self) -> String
Get the path of the current URL. Read more
Source§fn can_go_back(&self) -> bool
fn can_go_back(&self) -> bool
Check whether there is a previous page to navigate back to. Read more
Source§fn can_go_forward(&self) -> bool
fn can_go_forward(&self) -> bool
Check whether there is a future page to navigate forward to. Read more
Source§fn go_forward(&self)
fn go_forward(&self)
Go forward to a future page. Read more
Source§fn updater(&self, callback: Arc<dyn Fn() + Send + Sync>)
fn updater(&self, callback: Arc<dyn Fn() + Send + Sync>)
Provide the [
HistoryProvider
] with an update callback. Read moreSource§fn include_prevent_default(&self) -> bool
fn include_prevent_default(&self) -> bool
Whether the router should include the legacy prevent default attribute instead of the new
prevent default method. This should only be used by liveview.
Auto Trait Implementations§
impl !Freeze for MemoryHistory
impl !RefUnwindSafe for MemoryHistory
impl Send for MemoryHistory
impl !Sync for MemoryHistory
impl Unpin for MemoryHistory
impl UnwindSafe for MemoryHistory
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
Mutably borrows from an owned value. Read more
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<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.