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