From 2539042b71d70afd4d8f262783d441e768811ee9 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 28 Apr 2020 06:24:12 +0200 Subject: Remove `Drawable` and rename `State` to `Program` --- wgpu/src/widget/canvas/drawable.rs | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 wgpu/src/widget/canvas/drawable.rs (limited to 'wgpu/src/widget/canvas/drawable.rs') diff --git a/wgpu/src/widget/canvas/drawable.rs b/wgpu/src/widget/canvas/drawable.rs deleted file mode 100644 index 5209fa6f..00000000 --- a/wgpu/src/widget/canvas/drawable.rs +++ /dev/null @@ -1,36 +0,0 @@ -use crate::canvas::Frame; - -/// A type that can be drawn on a [`Frame`]. -/// -/// [`Frame`]: struct.Frame.html -pub trait Drawable { - /// Draws the [`Drawable`] on the given [`Frame`]. - /// - /// [`Drawable`]: trait.Drawable.html - /// [`Frame`]: struct.Frame.html - fn draw(&self, frame: &mut Frame); -} - -impl<'a> Drawable for dyn Fn(&mut Frame) + 'a { - fn draw(&self, frame: &mut Frame) { - self(frame) - } -} - -impl Drawable for &T -where - T: Drawable, -{ - fn draw(&self, frame: &mut Frame) { - T::draw(self, frame) - } -} - -impl Drawable for &[T] -where - T: Drawable, -{ - fn draw(&self, frame: &mut Frame) { - self.iter().for_each(|drawable| drawable.draw(frame)); - } -} -- cgit