I am not sure why I cannot access any field on my Vector... that Vector is an optional property (that now exists) of my dinner variable:
struct Dinner {
name: String,
dishes: Option<Vec<Dishes>>
}
let mut dinner = Dinner::new();
dinner.dishes = Option::from(dinner.get_dishes());
for dish in dinner.dishes {
dish.temperature = Some("HOT");
}
println!("{:#?}", script);
error[E0609]: no field `temperature` on type `Vec<Dishes>`
--> src/main.rs:14:21
|
14 | dish.temperature = Some("HOT");
| ^^^^^^^^^^^ unknown field
Update:
I just found out that when looping through the dishes
for dish in dinner.dishes {
println!("{:#?}", dish)
}
There is only one entry, and that contains all my dishes... this is a Some(all my dishes are in here) and I need to access the content of that Some, I basically need to get rid of that Some() that wraps around the data I need to access.