Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate num;
- #[derive(Debug)]
- struct Vector2<S: num::Num>{
- x: S,
- y: S,
- }
- #[derive(Debug)]
- struct Vector2f64 {
- x: f64,
- y: f64,
- }
- fn main() {
- let v2 = Vector2 {x: 1.0, y: 2.0 };
- println!("Hello, world! {:?}", v2);
- let v2f64 = Vector2f64 {x: 3.0, y: 4.0};
- println!("Hello, float64 world! {:?}", v2f64);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement