jweinst1
4/2/2017 - 5:55 PM

simple struct example in rust

simple struct example in rust

struct Fish {
    size:i32,
    kind:i8,
    color:String
}


fn main() {
   let mut g = Fish{size:10, kind:2, color:"red".to_string()};
   g.color += " and blue";
   println!("The kind of fish is {}", g.kind);
   println!("The color of fish is {}", g.color);
}