Macro coord2d::new_coord[][src]

macro_rules! new_coord {
    () => { ... };
    ($x:expr, $y:expr) => { ... };
    ($y:expr) => { ... };
}

creating a new Coord

Example

use coord2d::*;
fn main () {
    let a: coords::Coord = new_coord!(1, 2.0);
    println!("{:?}", a);
    // returns Coord {x: 1.0, y: 2.0}
    let a: coords::Coord = new_coord!(2.0);
    println!("{:?}", a);
    // returns Coord {x: 0.0, y: 2.0}
}
  • the var a contains to var x and y as position in a graph (O, I, J)
  • it convert i32 ,i64, u32 ,u64 , usize ,isize and f32 to f64