]> git.lizzy.rs Git - rust.git/blob - src/test/auxiliary/cci_class_6.rs
a6d6372f88f2fff45eb8822edb979431786edeea
[rust.git] / src / test / auxiliary / cci_class_6.rs
1 // Copyright 2012 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.
4 //
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.
10
11 pub mod kitties {
12     pub struct cat<U> {
13         priv info : Vec<U> ,
14         priv meows : uint,
15
16         how_hungry : int,
17     }
18
19     impl<U> cat<U> {
20         pub fn speak<T>(&mut self, stuff: Vec<T> ) {
21             self.meows += stuff.len();
22         }
23
24         pub fn meow_count(&mut self) -> uint { self.meows }
25     }
26
27     pub fn cat<U>(in_x : uint, in_y : int, in_info: Vec<U> ) -> cat<U> {
28         cat {
29             meows: in_x,
30             how_hungry: in_y,
31             info: in_info
32         }
33     }
34 }