daily pastebin goal
14%
SHARE
TWEET

Untitled

a guest Mar 23rd, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fn main() {
  2.     let vec = [1, 2, 3];
  3.     let mut iter = vec.into_iter().peekable();
  4.  
  5.     while let Some(i) = iter.next() {
  6.         let mut next = None;
  7.  
  8.         if let Some(peek) = iter.peek() {
  9.             next = Some(**peek);
  10.             let ptr: *mut i32 = *peek as *const i32 as *mut i32;
  11.             unsafe { *ptr = *peek + 1 }
  12.         }
  13.  
  14.         println!("value: {}, next: {:?}", i, next);
  15.     }
  16. }
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