diff options
Diffstat (limited to 'wgpu/src/widget/canvas/drawable.rs')
-rw-r--r-- | wgpu/src/widget/canvas/drawable.rs | 36 |
1 files changed, 0 insertions, 36 deletions
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<T> Drawable for &T -where - T: Drawable, -{ - fn draw(&self, frame: &mut Frame) { - T::draw(self, frame) - } -} - -impl<T> Drawable for &[T] -where - T: Drawable, -{ - fn draw(&self, frame: &mut Frame) { - self.iter().for_each(|drawable| drawable.draw(frame)); - } -} |