From 0b5024d131d93cf4073479cd31506be826c1a4b2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tomas=20Wenstr=C3=B6m?= <tomas.wenstrom@gmail.com> Date: Tue, 5 Jan 2021 17:01:49 +0100 Subject: [PATCH] Rect macro --- src/common.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/common.rs b/src/common.rs index 283640e..442b11c 100644 --- a/src/common.rs +++ b/src/common.rs @@ -37,6 +37,13 @@ impl<T: AddAssign> AddAssign for Point2D<T> { } } +#[macro_export] +macro_rules! rect { + ( $x:expr, $y:expr ) => { + Rect { x: $x, y: $y } + }; +} + #[derive(Default)] pub struct Rect<T> { pub width: T, -- 2.11.0