Skip to main content

History

Trait History 

Source
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§

Source

fn current(&self) -> HistoryEntry

The current entry. Used to pick the initial route.

Source

fn push(&mut self, url: &str) -> EntryKey

Adds a new entry and returns its key.

Source

fn replace(&mut self, url: &str)

Changes the url of the current entry, keeping its key.

Source

fn back(&mut self)

Moves one entry back. The resulting entry is reported through History::poll.

Source

fn forward(&mut self)

Moves one entry forward. The resulting entry is reported through History::poll.

Source

fn can_go_back(&self) -> bool

Source

fn can_go_forward(&self) -> bool

Source

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".

Implementors§