Skip to content

make map_message generic #169

Closed
Closed
@spersson

Description

@spersson

I encoutered a problem when trying to grow my app into having a sub - (view/update/Msg/Model).

fn view(model: &Model) -> Vec<El<Msg>> {
    let sidebar = div![
        class!["sidebar"],
    ];
    let mut result = vec![sidebar];
    for (prop_id, prop) in &model.properties {
        result.push(property::view(prop).map_message(|m| Msg::Property(prop_id, m)));
    }
    result
}

This will not compile because map_message is not accepting closures, needs to be generic to do that.
In my case it has be a closure since it is dynamically adding an unique identifier to each message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions