pub trait History: Clone + PartialEq {
Show 15 methods
// Required methods
fn len(&self) -> usize;
fn go(&self, delta: isize);
fn push<'a>(&self, route: impl Into<Cow<'a, str>>);
fn replace<'a>(&self, route: impl Into<Cow<'a, str>>);
fn push_with_state<'a, T>(&self, route: impl Into<Cow<'a, str>>, state: T)
where T: 'static;
fn replace_with_state<'a, T>(
&self,
route: impl Into<Cow<'a, str>>,
state: T,
)
where T: 'static;
fn push_with_query<'a, Q>(
&self,
route: impl Into<Cow<'a, str>>,
query: Q,
) -> Result<(), <Q as ToQuery>::Error>
where Q: ToQuery;
fn replace_with_query<'a, Q>(
&self,
route: impl Into<Cow<'a, str>>,
query: Q,
) -> Result<(), <Q as ToQuery>::Error>
where Q: ToQuery;
fn push_with_query_and_state<'a, Q, T>(
&self,
route: impl Into<Cow<'a, str>>,
query: Q,
state: T,
) -> Result<(), <Q as ToQuery>::Error>
where Q: ToQuery,
T: 'static;
fn replace_with_query_and_state<'a, Q, T>(
&self,
route: impl Into<Cow<'a, str>>,
query: Q,
state: T,
) -> Result<(), <Q as ToQuery>::Error>
where Q: ToQuery,
T: 'static;
fn listen<CB>(&self, callback: CB) -> HistoryListener
where CB: Fn() + 'static;
fn location(&self) -> Location;
// Provided methods
fn is_empty(&self) -> bool { ... }
fn back(&self) { ... }
fn forward(&self) { ... }
}
Expand description
Required Methods§
Sourcefn go(&self, delta: isize)
fn go(&self, delta: isize)
Loads a specific page in History
with a delta
relative to current page.
See: https://developer.mozilla.org/en-US/docs/Web/API/History/go
Sourcefn push<'a>(&self, route: impl Into<Cow<'a, str>>)
fn push<'a>(&self, route: impl Into<Cow<'a, str>>)
Pushes a route entry with None
being the state.
Sourcefn replace<'a>(&self, route: impl Into<Cow<'a, str>>)
fn replace<'a>(&self, route: impl Into<Cow<'a, str>>)
Replaces the current history entry with provided route and None
state.
Sourcefn push_with_state<'a, T>(&self, route: impl Into<Cow<'a, str>>, state: T)where
T: 'static,
fn push_with_state<'a, T>(&self, route: impl Into<Cow<'a, str>>, state: T)where
T: 'static,
Pushes a route entry with state.
Sourcefn replace_with_state<'a, T>(&self, route: impl Into<Cow<'a, str>>, state: T)where
T: 'static,
fn replace_with_state<'a, T>(&self, route: impl Into<Cow<'a, str>>, state: T)where
T: 'static,
Replaces the current history entry with provided route and state.
Sourcefn push_with_query<'a, Q>(
&self,
route: impl Into<Cow<'a, str>>,
query: Q,
) -> Result<(), <Q as ToQuery>::Error>where
Q: ToQuery,
fn push_with_query<'a, Q>(
&self,
route: impl Into<Cow<'a, str>>,
query: Q,
) -> Result<(), <Q as ToQuery>::Error>where
Q: ToQuery,
Same as .push()
but affix the queries to the end of the route.
Sourcefn replace_with_query<'a, Q>(
&self,
route: impl Into<Cow<'a, str>>,
query: Q,
) -> Result<(), <Q as ToQuery>::Error>where
Q: ToQuery,
fn replace_with_query<'a, Q>(
&self,
route: impl Into<Cow<'a, str>>,
query: Q,
) -> Result<(), <Q as ToQuery>::Error>where
Q: ToQuery,
Same as .replace()
but affix the queries to the end of the route.
Sourcefn push_with_query_and_state<'a, Q, T>(
&self,
route: impl Into<Cow<'a, str>>,
query: Q,
state: T,
) -> Result<(), <Q as ToQuery>::Error>where
Q: ToQuery,
T: 'static,
fn push_with_query_and_state<'a, Q, T>(
&self,
route: impl Into<Cow<'a, str>>,
query: Q,
state: T,
) -> Result<(), <Q as ToQuery>::Error>where
Q: ToQuery,
T: 'static,
Same as .push_with_state()
but affix the queries to the end of the route.
Sourcefn replace_with_query_and_state<'a, Q, T>(
&self,
route: impl Into<Cow<'a, str>>,
query: Q,
state: T,
) -> Result<(), <Q as ToQuery>::Error>where
Q: ToQuery,
T: 'static,
fn replace_with_query_and_state<'a, Q, T>(
&self,
route: impl Into<Cow<'a, str>>,
query: Q,
state: T,
) -> Result<(), <Q as ToQuery>::Error>where
Q: ToQuery,
T: 'static,
Same as .replace_with_state()
but affix the queries to the end of the route.
Sourcefn listen<CB>(&self, callback: CB) -> HistoryListenerwhere
CB: Fn() + 'static,
fn listen<CB>(&self, callback: CB) -> HistoryListenerwhere
CB: Fn() + 'static,
Creates a Listener that will be notified when current state changes.
This method returns a HistoryListener
that will automatically unregister the callback
when dropped.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.