structs ing..

This commit is contained in:
blacktoast 2021-09-30 07:09:19 +00:00
parent 235b8ff018
commit d6953d34f4
2 changed files with 5 additions and 3 deletions

View File

@ -32,7 +32,7 @@ mod tests {
#[test]
fn tuple_structs() {
// TODO: Instantiate a tuple struct!
let green =(String::from("en"),String::from("#00FF00"));
let green =(String::from("green"),String::from("#00FF00"));
assert_eq!(green.0, "green");
assert_eq!(green.1, "#00FF00");
@ -41,7 +41,9 @@ mod tests {
#[test]
fn unit_structs() {
// TODO: Instantiate a unit struct!
let unit_structs =String::from("UnitStructsss");
let unit_structs ={
let str=String::from("test");
};
let message = format!("{:?}s are fun!", unit_structs);
assert_eq!(message, "UnitStructs are fun!");

View File

@ -1,7 +1,6 @@
// structs2.rs
// Address all the TODOs to make the tests pass!
// I AM NOT DONE
#[derive(Debug)]
struct Order {
@ -37,6 +36,7 @@ mod tests {
// TODO: Create your own order using the update syntax and template above!
let mut your_order=Order{
name:String::from("Hacker in Rust"),
count: 1,
..order_template
};