Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. extern crate num;
  2.  
  3. #[derive(Debug)]
  4. struct Vector2<S: num::Num>{
  5. x: S,
  6. y: S,
  7. }
  8.  
  9. #[derive(Debug)]
  10. struct Vector2f64 {
  11. x: f64,
  12. y: f64,
  13. }
  14.  
  15. fn main() {
  16. let v2 = Vector2 {x: 1.0, y: 2.0 };
  17. println!("Hello, world! {:?}", v2);
  18.  
  19. let v2f64 = Vector2f64 {x: 3.0, y: 4.0};
  20. println!("Hello, float64 world! {:?}", v2f64);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement