SHARE
TWEET

Untitled

a guest May 25th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #[derive(Debug, Copy, Clone)]
  2.  
  3. struct I(u64);
  4.  
  5. fn main() {
  6.     let v: Vec<_> = (1..=3).map(|i| I(i)).collect();
  7.     println!("{:?}", v[2]);
  8.    
  9.     let a: [_; 3] = [I(1), I(2), I(3)];
  10.     println!("{:?}", a[2]);
  11.    
  12.     let mut a: [_; 3] = [I(1); 3];
  13.     a.iter_mut().enumerate().for_each(|(i, e)| *e = I(i as u64 + 1));
  14.     println!("{:?}", a[2]);
  15. }
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