diff options
author | 2020-03-04 21:56:59 +0100 | |
---|---|---|
committer | 2020-03-04 21:56:59 +0100 | |
commit | b6926d9ab4ae0c45049c3a8c19616939cbe9db95 (patch) | |
tree | eda8e51b653edd18da5a41393ba8163881c1f8da /wgpu/src/widget | |
parent | 012b4adec7a87331b2d75f6bc5d2a0189dcd7ec5 (diff) | |
download | iced-b6926d9ab4ae0c45049c3a8c19616939cbe9db95.tar.gz iced-b6926d9ab4ae0c45049c3a8c19616939cbe9db95.tar.bz2 iced-b6926d9ab4ae0c45049c3a8c19616939cbe9db95.zip |
Improve `Debug` implementation of `cache::State`
Diffstat (limited to 'wgpu/src/widget')
-rw-r--r-- | wgpu/src/widget/canvas/layer/cache.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/wgpu/src/widget/canvas/layer/cache.rs b/wgpu/src/widget/canvas/layer/cache.rs index 3071cce0..8f265142 100644 --- a/wgpu/src/widget/canvas/layer/cache.rs +++ b/wgpu/src/widget/canvas/layer/cache.rs @@ -21,7 +21,6 @@ pub struct Cache<T: Drawable> { state: RefCell<State>, } -#[derive(Debug)] enum State { Empty, Filled { @@ -99,3 +98,17 @@ where mesh } } + +impl std::fmt::Debug for State { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + State::Empty => write!(f, "Empty"), + State::Filled { mesh, bounds } => f + .debug_struct("Filled") + .field("vertices", &mesh.vertices.len()) + .field("indices", &mesh.indices.len()) + .field("bounds", bounds) + .finish(), + } + } +} |