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

Add support for custom struct as sketch parameter #66

Merged
merged 1 commit into from
Nov 27, 2023
Merged

Conversation

abey79
Copy link
Owner

@abey79 abey79 commented Nov 26, 2023

This PR adds support for custom struct (both with named and unnamed fields) to be used as sketch parameter. This is done via the new Widget derive macro:

#[derive(Sketch, Default)]
struct DemoSketch {
    custom_struct: CustomStruct,
}

#[derive(Widget, Default)]
struct CustomStruct {
   #[param(slider, min = 0.0, max = 10.0)]
   my_param: f64,
}

Nesting is supported.

A new ui_demo.rs example is introduced to demonstrate/test all supported types and combinations.

@abey79 abey79 merged commit 38a5e83 into master Nov 27, 2023
4 checks passed
@abey79 abey79 deleted the widget-derive branch November 27, 2023 06:57
@abey79 abey79 added the whiskers Relates to whiskers or whiskers-derive label Dec 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
whiskers Relates to whiskers or whiskers-derive
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant