Skip to content

Commit

Permalink
impl default for canvas cache
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede committed Apr 6, 2020
1 parent ad0a6c4 commit eae6820
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions wgpu/src/widget/canvas/layer/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: Drawable> {
input: PhantomData<T>,
state: RefCell<State>,
Expand All @@ -27,6 +27,12 @@ enum State {
},
}

impl Default for State {
fn default() -> Self {
State::Empty
}
}

impl<T> Cache<T>
where
T: Drawable + std::fmt::Debug,
Expand All @@ -37,7 +43,7 @@ where
pub fn new() -> Self {
Cache {
input: PhantomData,
state: RefCell::new(State::Empty),
state: RefCell::new(State::default()),
}
}

Expand Down

0 comments on commit eae6820

Please sign in to comment.