# Usage ```rust use plaster_router::{Routes, route_to}; #[derive(Routes)] pub enum MyRoutes { #[route("/posts")] Posts, #[route("/posts/:id")] Post { id: String }, } pub struct MyComponent { router: Router, } impl Component for MyComponent { fn create(_:_, mut context: ComponentLink) -> MyComponent { let mut router = MyRoutes::router(context.send_back(|| Msg::RouteUpdate)); MyComponent { router: router, } } fn update(msg: Msg) -> ShouldRender { match msg { Msg::RouteUpdate => true, Msg::RouteTo(route) => { route_to(&route); true }, } } } impl Renderable on MyComponent { fn view(&self) -> Html { match self.router.resolve() { Some(MyRoutes::Posts) => html! { }, Some(MyRoutes::Post { id }) => html! {

{format!("Post {}", id)}

}, None => html! {

404 Not Found

} } } } ```