2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2018-08-31 08:02:01 -05:00
|
|
|
#![allow(non_camel_case_types)]
|
|
|
|
|
2013-12-10 01:16:18 -06:00
|
|
|
struct Clam<'a> {
|
2015-03-25 19:06:52 -05:00
|
|
|
chowder: &'a isize
|
2013-02-11 18:33:31 -06:00
|
|
|
}
|
2012-04-01 16:28:30 -05:00
|
|
|
|
2013-12-10 01:16:18 -06:00
|
|
|
trait get_chowder<'a> {
|
2015-03-25 19:06:52 -05:00
|
|
|
fn get_chowder(&self) -> &'a isize;
|
2012-07-11 17:00:40 -05:00
|
|
|
}
|
|
|
|
|
2013-12-10 01:16:18 -06:00
|
|
|
impl<'a> get_chowder<'a> for Clam<'a> {
|
2015-03-25 19:06:52 -05:00
|
|
|
fn get_chowder(&self) -> &'a isize { return self.chowder; }
|
2012-03-15 20:13:12 -05:00
|
|
|
}
|
|
|
|
|
2013-02-01 21:43:17 -06:00
|
|
|
pub fn main() {
|
2013-01-26 00:46:32 -06:00
|
|
|
let clam = Clam { chowder: &3 };
|
2014-10-14 20:07:11 -05:00
|
|
|
println!("{}", *clam.get_chowder());
|
2012-03-23 13:37:10 -05:00
|
|
|
clam.get_chowder();
|
2012-03-15 20:13:12 -05:00
|
|
|
}
|