From: Ian Jackson Date: Sat, 14 May 2022 22:29:21 +0000 (+0100) Subject: impl OutlineTrait via ambassador for GenericSimpleShape X-Git-Tag: otter-1.1.0~155 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=a7907dccf3bf212171c9022ce1c5650d1ade593c;p=otter.git impl OutlineTrait via ambassador for GenericSimpleShape Signed-off-by: Ian Jackson --- 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"##