2018-12-16 21:21:47 -06:00
|
|
|
trait Animal {
|
2013-03-12 21:32:14 -05:00
|
|
|
fn eat(&self);
|
2012-04-11 18:18:00 -05:00
|
|
|
}
|
|
|
|
|
2018-12-16 21:21:47 -06:00
|
|
|
struct Cat {
|
2015-01-08 05:02:42 -06:00
|
|
|
meows: usize,
|
2012-09-05 17:58:43 -05:00
|
|
|
}
|
|
|
|
|
2018-12-16 21:21:47 -06:00
|
|
|
impl Animal for Cat {
|
2014-08-05 21:44:21 -05:00
|
|
|
//~^ ERROR not all trait items implemented, missing: `eat`
|
2012-09-10 20:00:03 -05:00
|
|
|
}
|
|
|
|
|
2018-12-16 21:21:47 -06:00
|
|
|
fn cat(in_x : usize) -> Cat {
|
|
|
|
Cat {
|
2012-09-05 17:58:43 -05:00
|
|
|
meows: in_x
|
|
|
|
}
|
2012-04-11 18:18:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2015-03-03 02:42:26 -06:00
|
|
|
let nyan = cat(0);
|
2013-02-14 13:47:00 -06:00
|
|
|
}
|