diff options
author | 2020-04-19 14:39:30 +0200 | |
---|---|---|
committer | 2020-04-19 14:39:30 +0200 | |
commit | 0b5028b1ab47707a469176e9bf20cacdd3a19861 (patch) | |
tree | ba4ea88bbb5e3d3ebf22699a758c30181f535b35 /wgpu/src/widget/canvas/layer/cache.rs | |
parent | 90c3a183d5e79aee1f323991c8c45161ccf9e187 (diff) | |
download | iced-0b5028b1ab47707a469176e9bf20cacdd3a19861.tar.gz iced-0b5028b1ab47707a469176e9bf20cacdd3a19861.tar.bz2 iced-0b5028b1ab47707a469176e9bf20cacdd3a19861.zip |
Draft `Program` interactivity for `Canvas`
Diffstat (limited to 'wgpu/src/widget/canvas/layer/cache.rs')
-rw-r--r-- | wgpu/src/widget/canvas/layer/cache.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/wgpu/src/widget/canvas/layer/cache.rs b/wgpu/src/widget/canvas/layer/cache.rs index 4f8c2bec..2e87297c 100644 --- a/wgpu/src/widget/canvas/layer/cache.rs +++ b/wgpu/src/widget/canvas/layer/cache.rs @@ -1,5 +1,5 @@ use crate::{ - canvas::{Drawable, Frame, Layer}, + canvas::{Drawable, Frame, Layer, Program}, Primitive, }; @@ -79,6 +79,20 @@ where } } +impl<T> Program for Cache<T> +where + T: Drawable + std::fmt::Debug, +{ + type Input = T; + + fn layers<'a>( + &'a self, + input: &'a Self::Input, + ) -> Vec<Box<dyn Layer + 'a>> { + vec![Box::new(self.with(input))] + } +} + #[derive(Debug)] struct Bind<'a, T: Drawable> { cache: &'a Cache<T>, |