pub struct RouteService<STATE = ()> { /* private fields */ }
Expand description
A service that facilitates manipulation of the browser’s URL bar and responding to browser events when users press ‘forward’ or ‘back’.
The T
determines what route state can be stored in the route service.
Implementations§
Source§impl<T> RouteService<T>
impl<T> RouteService<T>
Sourcepub fn new() -> RouteService<T>
pub fn new() -> RouteService<T>
Creates the route service.
Sourcepub fn get_fragment(&self) -> String
pub fn get_fragment(&self) -> String
Gets the fragment of the current url.
Source§impl<STATE> RouteService<STATE>where
STATE: RouteState,
impl<STATE> RouteService<STATE>where
STATE: RouteState,
Sourcepub fn register_callback(&mut self, callback: Callback<Route<STATE>>)
pub fn register_callback(&mut self, callback: Callback<Route<STATE>>)
Registers a callback to the route service. Callbacks will be called when the History API experiences a change such as popping a state off of its stack when the forward or back buttons are pressed.
Sourcepub fn set_route(&mut self, route: &str, state: STATE)
pub fn set_route(&mut self, route: &str, state: STATE)
Sets the browser’s url bar to contain the provided route, and creates a history entry that can be navigated via the forward and back buttons.
The route should be a relative path that starts with a /
.
Sourcepub fn replace_route(&mut self, route: &str, state: STATE)
pub fn replace_route(&mut self, route: &str, state: STATE)
Replaces the route with another one removing the most recent history event and creating another history event in its place.
Trait Implementations§
Source§impl<STATE: Debug> Debug for RouteService<STATE>
impl<STATE: Debug> Debug for RouteService<STATE>
Source§impl<STATE> Default for RouteService<STATE>where
STATE: RouteState,
impl<STATE> Default for RouteService<STATE>where
STATE: RouteState,
Auto Trait Implementations§
impl<STATE> Freeze for RouteService<STATE>
impl<STATE = ()> !RefUnwindSafe for RouteService<STATE>
impl<STATE = ()> !Send for RouteService<STATE>
impl<STATE = ()> !Sync for RouteService<STATE>
impl<STATE> Unpin for RouteService<STATE>where
STATE: Unpin,
impl<STATE = ()> !UnwindSafe for RouteService<STATE>
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
Source§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
self
to a value of a Properties
struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
self
to a value of a Properties
struct.