[][src]Struct router_rs::prelude::Router

pub struct Router { /* fields omitted */ }

Holds all of the routes for an application.

A typical use case is that when we want to move to a new route (such as after clicking on an anchor tag) we'll query our router to see if the new route matches any of our route definitions.

Then if we find a matching route we'll return it.

Methods

impl Router[src]

pub fn provide<T: 'static>(&mut self, provided: T)[src]

Provide the application state data that different routes need.

impl Router[src]

pub fn set_route_handlers(&mut self, route_handlers: Vec<Box<dyn RouteHandler>>)[src]

Push a vector of Routes into the Router

pub fn view(&self, incoming_route: &str) -> Option<VirtualNode>[src]

Get the first route in our routes vector view that handles this incoming_route and return the view for that route.

You'll typically call this when trying to render the correct view based on the page URL or after clicking on an anchor tag.

Trait Implementations

impl Default for Router[src]

Auto Trait Implementations

impl !Send for Router

impl !Sync for Router

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]