Skip to content

05_tickets_v2 03_variants_with_data.md Bindigs explanation error #211

Open
@kurbanboi

Description

@kurbanboi

Bindings

In the match pattern Status::InProgress { assigned_to }, assigned_to is a binding.
We're destructuring the Status::InProgress variant and binding the assigned_to field to
a new variable,

[also named assigned_to.] <= this should be [named person]

If we wanted, we could bind the field to a different variable name:

match status {
    Status::InProgress { assigned_to: person } => {
        println!("Assigned to: {}", person);
    },
    Status::ToDo | Status::Done => {
        println!("Done");
    }
}

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