From eae682051618872646c22db68919a803486ec36e Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Mon, 6 Apr 2020 01:35:37 +0100 Subject: [PATCH] impl default for canvas cache --- wgpu/src/widget/canvas/layer/cache.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wgpu/src/widget/canvas/layer/cache.rs b/wgpu/src/widget/canvas/layer/cache.rs index 20a095bdde..feebb812a7 100644 --- a/wgpu/src/widget/canvas/layer/cache.rs +++ b/wgpu/src/widget/canvas/layer/cache.rs @@ -13,7 +13,7 @@ use std::{cell::RefCell, marker::PhantomData, sync::Arc}; /// /// [`Layer`]: ../trait.Layer.html /// [`Cache`]: struct.Cache.html -#[derive(Debug)] +#[derive(Debug, Default)] pub struct Cache { input: PhantomData, state: RefCell, @@ -27,6 +27,12 @@ enum State { }, } +impl Default for State { + fn default() -> Self { + State::Empty + } +} + impl Cache where T: Drawable + std::fmt::Debug, @@ -37,7 +43,7 @@ where pub fn new() -> Self { Cache { input: PhantomData, - state: RefCell::new(State::Empty), + state: RefCell::new(State::default()), } }