Hands-on Rust: Missing Vector Initialization in Enum Section of Chapter 2

Hey All,

In the last section of Chapter 2 talking about Enums we are missing an explanation on how to initialize the Vector entries with the new Enums. Particularly confusing is how to initialize an Enum with data

Grabbing it from the source code on the website makes it clear:

    let mut visitor_list = vec![
        Visitor::new("Bert", VisitorAction::Accept, 45),
        Visitor::new("Steve", VisitorAction::AcceptWithNote{ note: String::from("Lactose-free milk is in the fridge") }, 15),
        Visitor::new("Fred", VisitorAction::Refuse, 30),
    ];

Just a suggestion but a short bit on that in the enum section would be great!

3 Likes