Advertisement
cwchen

[Rust] Call Vector class from main.

Sep 14th, 2017
940
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.36 KB | None | 0 0
  1. fn main() {
  2.     let v1 = vec![1, 2, 3];
  3.     let v2 = vec![2, 3, 4];
  4.  
  5.     let vec1 = Vector::<i32>::from_slice(&v1);
  6.     let vec2 = Vector::<i32>::from_slice(&v2);
  7.  
  8.     // We have to explictly clone our Vector object at present.
  9.     let vec3 = vec1.clone() + vec2.clone();
  10.  
  11.     println!("{:?}", vec1);
  12.     println!("{:?}", vec2);
  13.     println!("{:?}", vec3);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement