Description
While Switch is an ok name for what it does, I think something along the lines of Routable would be more appropriate.
I don't intend to make this change for 8.0, but would like to create this issue so that interested parties can prepare their codebase for this change.
This change will come in 3 pieces.
@hgzimmerman Also, I think it would make much more sense to name the to attribute at instead:
#[derive(Switch, Debug)]
pub enum AppRoute {
#[at = "/profile/{id}"]
Profile(u32),
#[at = "/forum{*:rest}"]
Forum(ForumRoute),
#[at = "/"]
Index,
}
#[derive(Switch, Debug)]
pub enum ForumRoute {
#[at = "/{subforum}/{thread_slug}"]
SubForumAndThread{subforum: String, thread_slug: String}
#[at = "/{subforum}"]
SubForum{subforum: String}
}
Because links/buttons route to somewhere (it's an action to follow a link) but the routes are defined at a certain url, and at also reflects the fact that it's declarative better.
Most helpful comment
@hgzimmerman Also, I think it would make much more sense to name the
toattributeatinstead:Because links/buttons route
tosomewhere (it's an action to follow a link) but the routes are definedata certain url, andatalso reflects the fact that it's declarative better.