Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impl default for canvas cache #267

Merged
merged 1 commit into from
Apr 8, 2020

Conversation

robjtede
Copy link
Contributor

@robjtede robjtede commented Apr 6, 2020

Previously needed to write the full Default implementation:

#[derive(Debug)]
pub struct AppState {
    all_data: State,
    current_frame_data: D,
    current_frame_canvas_cache: canvas::layer::Cache<D>,
}

impl Default for AppState {
    fn default() -> Self {
        Self {
            all_data: Default::default(),
            current_frame_data: Default::default(),
            current_frame_canvas_cache: iced::widget::canvas::layer::Cache::new(),
        }
    }
}

Now deriving a default application state is possible:

#[derive(Debug, Default)]
pub struct AppState {
    all_data: State,
    current_frame_data: D,
    current_frame_canvas_cache: canvas::layer::Cache<D>,
}

@hecrj hecrj added the feature New feature or request label Apr 6, 2020
@hecrj hecrj added this to the 0.1.1 milestone Apr 6, 2020
wgpu/src/widget/canvas/layer/cache.rs Outdated Show resolved Hide resolved
@robjtede robjtede force-pushed the improve/canvas-cache-default branch from eae6820 to 6e7769b Compare April 8, 2020 22:08
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome 🎉 Thank you!

@hecrj hecrj merged commit d51b501 into iced-rs:master Apr 8, 2020
@robjtede robjtede deleted the improve/canvas-cache-default branch April 8, 2020 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants