Advertisement
cwchen

[Rust] Creating a vector, pushing some values.

Aug 22nd, 2017
723
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.26 KB | None | 0 0
  1. fn main {
  2.     /* Type inference works here,
  3.        so we don't explicitly declare
  4.        the type of vec. */
  5.     let mut vec = Vec::new();  // vec<i32>
  6.  
  7.     // Append data into the tail of the vector
  8.     vec.push(1);
  9.     vec.push(2);
  10.     vec.push(3);
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement