daily pastebin goal
11%
SHARE
TWEET

Untitled

a guest Sep 20th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #[derive(Debug)]
  2. struct S<'a> {
  3.     v: Vec<&'a usize>
  4. }
  5.  
  6. impl<'a> S<'a> {
  7.     pub fn new() -> S<'a> {
  8.         S {
  9.             v: Vec::new(),
  10.         }
  11.     }
  12. }
  13.  
  14. fn main() {
  15.     let mut arr = [0usize; 10];
  16.     let mut s = S::new();
  17.     for i in 0..10 {
  18.         arr[i] = i;
  19.     }
  20.     s.v.extend(&arr);
  21.     println!("arr: {:?}", arr);
  22.     println!("s: {:?}", s);
  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
 
Top