Skip to content

Add field-level attribute to set/get state. #1109

@hgzimmerman

Description

@hgzimmerman

Description

While the Switch trait allows for it, the derive Switch macro support for getting/setting the state is nonexistent, relying on manual implementations to actually allow setting the state.

This is fine for the moment, where just supporting the () state type is acceptable, but in the future, the macro needs to support setting and getting the state.

This might look like:

#[derive(Switch)]
enum AppRoute {
    #[to="/home/{name}"]
    Variant{
        name: String,
        #[state]
        state: JsValue
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions