You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I couldn't reproduce your problem, which may be because your training questions are not the latest
There is no content in line 35 of my training question
Here is my 'struct 2', please check it
Additionally:‘ assert_eq!’ It allows the comparison between String and &str
#[derive(Debug)]structOrder{name:String,year:u32,made_by_phone:bool,made_by_mobile:bool,made_by_email:bool,item_number:u32,count:u32,}fncreate_order_template() -> Order{Order{name:String::from("Bob"),year:2019,made_by_phone:false,made_by_mobile:false,made_by_email:true,item_number:123,count:0,}}fnmain(){// You can optionally experiment here.}#[cfg(test)]mod tests {usesuper::*;#[test]fnyour_order(){let order_template = create_order_template();// TODO: Create your own order using the update syntax and template above!let your_order = Order{name:String::from("Hacker in Rust"),year:2019,made_by_phone:false,made_by_mobile:false,made_by_email:true,item_number:123,count:1,};assert_eq!(your_order.name,"Hacker in Rust");assert_eq!(your_order.year, order_template.year);assert_eq!(your_order.made_by_phone, order_template.made_by_phone);assert_eq!(your_order.made_by_mobile, order_template.made_by_mobile);assert_eq!(your_order.made_by_email, order_template.made_by_email);assert_eq!(your_order.item_number, order_template.item_number);assert_eq!(your_order.count,1);}}
Line 35 throws a "expected String, found &str"
From how the exercise is structured it looks like I am not supposed to edit this line.
I don't know enough Rust to know why it throws this, but I had to Chat GPT this error to get the exercise to function properly.
The text was updated successfully, but these errors were encountered: