pub trait History {
// Required methods
fn current(&self) -> HistoryEntry;
fn push(&mut self, url: &str) -> EntryKey;
fn replace(&mut self, url: &str);
fn back(&mut self);
fn forward(&mut self);
fn can_go_back(&self) -> bool;
fn can_go_forward(&self) -> bool;
fn poll(&mut self, ctx: &Context) -> Option<HistoryEntry>;
}Expand description
A session history the router keeps in sync with the current page.
Required Methods§
Sourcefn current(&self) -> HistoryEntry
fn current(&self) -> HistoryEntry
The current entry. Used to pick the initial route.
Sourcefn back(&mut self)
fn back(&mut self)
Moves one entry back. The resulting entry is reported through History::poll.
Sourcefn forward(&mut self)
fn forward(&mut self)
Moves one entry forward. The resulting entry is reported through History::poll.
fn can_go_back(&self) -> bool
fn can_go_forward(&self) -> bool
Sourcefn poll(&mut self, ctx: &Context) -> Option<HistoryEntry>
fn poll(&mut self, ctx: &Context) -> Option<HistoryEntry>
Returns the entry the history moved to by itself since the last call (back/forward,
or the browser’s buttons). Entries the history doesn’t know (e.g. the user edited the
url’s #hash) must be given a fresh key.
ctx can be stored to request a repaint when such a change happens outside a frame.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".