add structs
This commit is contained in:
@@ -12,6 +12,12 @@ enum Status
|
||||
Failed(String)
|
||||
}
|
||||
|
||||
struct RGB
|
||||
{
|
||||
red: i32,
|
||||
green: i32,
|
||||
blue: i32,
|
||||
}
|
||||
fn main() {
|
||||
// normal Enum
|
||||
let direction = Direction::Down;
|
||||
@@ -29,4 +35,10 @@ fn main() {
|
||||
Status::Succeeded(message) => println!("Succeeded with msg: {}",message),
|
||||
Status::Failed(message) => println!("Failed with msg: {}",message),
|
||||
}
|
||||
|
||||
// struct
|
||||
let color = RGB{red:255,green:255,blue:255};
|
||||
println!("color has R:{} G:{} B:{}",color.red,color.green,color.blue);
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user