]>
git.proxmox.com Git - rustc.git/blob - src/test/run-pass/class-implement-traits.rs
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.
27 self.meows
+= 1_usize
;
28 if self.meows
% 5_usize
== 0_usize
{
35 pub fn eat(&mut self) -> bool
{
36 if self.how_hungry
> 0 {
37 println
!("OM NOM NOM");
41 println
!("Not hungry!");
48 fn speak(&mut self) { self.meow(); }
51 fn cat(in_x
: usize, in_y
: isize, in_name
: String
) -> cat
{
60 fn make_speak
<C
:noisy
>(mut c
: C
) {
65 let mut nyan
= cat(0_usize
, 2, "nyan".to_string());
67 assert
!((!nyan
.eat()));
68 for _
in 1_usize
..10_usize
{
69 make_speak(nyan
.clone());