From a7907dccf3bf212171c9022ce1c5650d1ade593c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 14 May 2022 23:29:21 +0100 Subject: [PATCH] impl OutlineTrait via ambassador for GenericSimpleShape Signed-off-by: Ian Jackson --- src/pieces.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/pieces.rs b/src/pieces.rs index bb38f948..0592b0cf 100644 --- a/src/pieces.rs +++ b/src/pieces.rs @@ -105,17 +105,14 @@ pub fn svg_rectangle_path(PosC{coords: [x,y]}: PosC) -> Html { -x*0.5, -y*0.5, x, y, -x) } -#[dyn_upcast] -impl OutlineTrait for GenericSimpleShape - where Desc: Debug + Send + Sync + 'static, - Outl: OutlineTrait, -{ - delegate! { - to self.outline { - fn outline_path(&self, scale: f64) -> Result; - fn thresh_dragraise(&self) -> Result,IE>; - fn bbox_approx(&self) -> Result; - } +impl_via_ambassador! { + #[dyn_upcast] + impl [ Desc, Outl:'static ] + OutlineTrait for GenericSimpleShape + where [ Desc: Debug + Send + Sync + 'static, + Outl: OutlineTrait, ] + { + outline } } // let edge_attrs = format!(r##"stroke-width="" stroke"## -- 2.30.2