SHARE
TWEET

Untitled

a guest Aug 23rd, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fn main() {
  2.     let a = "a".to_string();
  3.     let a_ref = &a;
  4.     let b_ref;
  5.     let g_ref;
  6.     // let h_ref;
  7.     // let i_ref;
  8.     // let j_ref;
  9.     {
  10.         let b = "b".to_string();
  11.         b_ref = &b;
  12.         let (c_ref, _d_ref) = return_tuple(a_ref, b_ref);
  13.         g_ref = c_ref;
  14.         // h_ref = d_ref;
  15.        
  16.         // let (x_ref, y_ref) = return_tuple_strict(a_ref, b_ref);
  17.         // i_ref = x_ref;
  18.         // j_ref = y_ref;
  19.     }
  20.     println!("{}", g_ref);
  21.     // println!("{}", h_ref);
  22.    
  23.     // println!("{}", i_ref);
  24.     // println!("{}", j_ref);
  25. }
  26.  
  27. fn return_tuple<'a, 'b>(a: &'a str, b: &'b str) -> (&'a str, &'b str) {
  28.     (a, b)
  29. }
  30.  
  31. fn return_tuple_strict<'a>(a: &'a str, b: &'a str) -> (&'a str, &'a str) {
  32.     (a, b)
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top