Advertisement
cwchen

[Rust] tuple struct demo.

Aug 23rd, 2017
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.17 KB | None | 0 0
  1. use std::f64;
  2.  
  3. struct Point(f64, f64);
  4.  
  5. fn main() {
  6.     let p = Point(3.0, 4.0);
  7.  
  8.     assert!(f64::abs(p.0 - 3.0) < 1e-10);
  9.     assert!(f64::abs(p.1 - 4.0) < 1e-10);
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement