SHARE
TWEET

Untitled

a guest Aug 23rd, 2019 80 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.     {
  7.         let b = "b".to_string();
  8.         b_ref = &b;
  9.         let (c_ref, _d_ref) = return_tuple(a_ref, b_ref);
  10.         g_ref = c_ref;
  11.         // h_ref = d_ref;
  12.     }
  13.     println!("{}", g_ref);
  14.     // println!("{}", h_ref);
  15. }
  16.  
  17. fn return_tuple<'a, 'b>(a: &'a str, b: &'b str) -> (&'a str, &'b str) {
  18.     (a, b)
  19. }
  20.  
  21. fn return_tuple_strict<'a>(a: &'a str, b: &'a str) -> (&'a str, &'a str) {
  22.     (a, b)
  23. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top