Replace macros for 2d literals by functions.

This commit is contained in:
Juergen Stuber
2018-12-02 14:21:59 +01:00
parent 9877915249
commit af5e1db20a
7 changed files with 64 additions and 68 deletions

View File

@ -2,13 +2,6 @@ use std::ops::Add;
use crate::vec2d::Vec2d;
#[macro_export]
macro_rules! p2 {
( $x:expr, $y:expr ) => {
Point2d::new($x, $y)
};
}
#[derive(Clone, Copy, Debug)]
pub struct Point2d {
pub x: i32,
@ -25,6 +18,10 @@ impl Point2d {
}
}
pub fn p2d(x: i32, y: i32) -> Point2d {
Point2d::new(x, y)
}
impl Add<Vec2d> for Point2d {
type Output = Point2d;