2013-08-17 10:37:42 -05:00
|
|
|
#[allow(dead_assignment)];
|
|
|
|
#[allow(unused_variable)];
|
|
|
|
|
2012-12-20 01:02:46 -06:00
|
|
|
enum Animal {
|
2013-09-26 01:26:09 -05:00
|
|
|
Dog (~str, f64),
|
|
|
|
Cat { name: ~str, weight: f64 }
|
2012-12-20 01:02:46 -06:00
|
|
|
}
|
|
|
|
|
2013-02-01 21:43:17 -06:00
|
|
|
pub fn main() {
|
2012-12-20 01:02:46 -06:00
|
|
|
let mut a: Animal = Dog(~"Cocoa", 37.2);
|
|
|
|
a = Cat{ name: ~"Spotty", weight: 2.7 };
|
|
|
|
// permuting the fields should work too
|
2013-08-17 10:37:42 -05:00
|
|
|
let _c = Cat { weight: 3.1, name: ~"Spreckles" };
|
2012-12-20 01:02:46 -06:00
|
|
|
}
|