Derive Macro dioxus_core_macro::Routable[][src]

#[derive(Routable)]
{
    // Attributes available to this derive:
    #[at]
    #[not_found]
}
Expand description

Derive macro used to mark an enum as Routable.

This macro can only be used on enums. Every varient of the macro needs to be marked with the at attribute to specify the URL of the route. It generates an implementation of yew_router::Routable trait and consts for the routes passed which are used with Route component.

Example

#[derive(Debug, Clone, Copy, PartialEq, Routable)]
enum Routes {
    #[at("/")]
    Home,
    #[at("/secure")]
    Secure,
    #[at("/profile/{id}")]
    Profile(u32),
    #[at("/404")]
    NotFound,
}