]> git.proxmox.com Git - rustc.git/blob - src/test/auxiliary/cci_class_6.rs
Imported Upstream version 1.0.0~0alpha
[rustc.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
13 pub struct cat<U> {
14 info : Vec<U> ,
15 meows : uint,
16
17 pub how_hungry : int,
18 }
19
20 impl<U> cat<U> {
21 pub fn speak<T>(&mut self, stuff: Vec<T> ) {
22 self.meows += stuff.len();
23 }
24
25 pub fn meow_count(&mut self) -> uint { self.meows }
26 }
27
28 pub fn cat<U>(in_x : uint, in_y : int, in_info: Vec<U> ) -> cat<U> {
29 cat {
30 meows: in_x,
31 how_hungry: in_y,
32 info: in_info
33 }
34 }
35 }