SHARE
TWEET

Untitled

a guest Jun 16th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
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