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