summaryrefslogblamecommitdiff
path: root/meap/meap-code/ch2/ch2-add-with-lifetimes_.rs
blob: 37b5c5f2f7028d7e120039cc6b440c9b2003cb3b (plain) (tree)
1
2
3
4
5
6
7
8







                                                               
fn add_with_lifetimes<'a, 'b>(i: &'a i32, j: &'b i32) -> i32 {
  *i + *j // <1>
}

fn main() {
  let res = add_with_lifetimes(&10, &20); // <2> <3>
  println!("{}", res);
}