Advertisement
cwchen

[Rust] Storing data into a vector.

Aug 22nd, 2017
721
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.18 KB | None | 0 0
  1. fn main() {
  2.     let mut vec = vec![1, 2, 3];
  3.  
  4.     vec[1] = 99;  // Feed data into vector
  5.  
  6.     assert_eq!(vec[0], 1);
  7.     assert_eq!(vec[1], 99);
  8.     assert_eq!(vec[2], 3);
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement