blob: fb7fad0b5a2e783307aebe505fc3bfb4c6d26bfc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
pub mod kitties {
pub struct cat {
meows : usize,
pub how_hungry : isize,
}
impl cat {
pub fn speak(&mut self) { self.meows += 1; }
pub fn meow_count(&mut self) -> usize { self.meows }
}
pub fn cat(in_x : usize, in_y : isize) -> cat {
cat {
meows: in_x,
how_hungry: in_y
}
}
}
|