2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2015-03-22 15:13:15 -05:00
|
|
|
|
2013-01-22 19:20:08 -06:00
|
|
|
struct SpeechMaker {
|
2015-03-25 19:06:52 -05:00
|
|
|
speeches: usize
|
2013-01-22 19:20:08 -06:00
|
|
|
}
|
|
|
|
|
2013-05-31 17:17:22 -05:00
|
|
|
impl SpeechMaker {
|
2015-03-25 19:06:52 -05:00
|
|
|
pub fn how_many(&self) -> usize { self.speeches }
|
2013-01-22 19:20:08 -06:00
|
|
|
}
|
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
fn foo(speaker: &SpeechMaker) -> usize {
|
2013-01-22 19:20:08 -06:00
|
|
|
speaker.how_many() + 33
|
|
|
|
}
|
|
|
|
|
2013-02-01 21:43:17 -06:00
|
|
|
pub fn main() {
|
2013-08-17 10:37:42 -05:00
|
|
|
let lincoln = SpeechMaker {speeches: 22};
|
2013-08-02 23:41:06 -05:00
|
|
|
assert_eq!(foo(&lincoln), 55);
|
2013-01-22 19:20:08 -06:00
|
|
|
}
|