1 // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // aux-build:cci_class_trait.rs
12 extern crate cci_class_trait;
13 use cci_class_trait::animals::noisy;
23 pub fn eat(&mut self) -> bool {
24 if self.how_hungry > 0 {
25 println!("OM NOM NOM");
30 println!("Not hungry!");
37 fn speak(&mut self) { self.meow(); }
44 if self.meows % 5u == 0u {
50 fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
60 let mut nyan = cat(0u, 2, ~"nyan");
62 assert!((!nyan.eat()));
63 for _ in range(1u, 10u) { nyan.speak(); };
64 assert!((nyan.eat()));