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

autoimpl; revise widget macros #258

Merged
merged 33 commits into from
Nov 29, 2021
Merged

autoimpl; revise widget macros #258

merged 33 commits into from
Nov 29, 2021

Conversation

dhardy
Copy link
Collaborator

@dhardy dhardy commented Nov 13, 2021

This PR revisits how widgets are implemented, also adding the autoimpl attribute-macro. WIP.

@dhardy
Copy link
Collaborator Author

dhardy commented Nov 15, 2021

There's still quite a bit to do for this PR:

  • make_widget should not invoke widget
  • eliminate core_data methods?
  • use quote_spanned when generating impls etc
  • implement Default?

Scratchboard for syntax ideas: https://gist.github.com/dhardy/97efb394311b8b9687c0d817e95654b9

It's tempting to allow custom values via `field: ty = val,`
but that is more complex and not included here.
@dhardy dhardy marked this pull request as ready for review November 29, 2021 13:54
@dhardy
Copy link
Collaborator Author

dhardy commented Nov 29, 2021

This is part of a series of changes aimed at improving the way widgets are constructed. It is not finished, but does achieve:

  • replace derive(Widget) with widget! { ... } macro
  • autodetection of whether widget traits like Layout are implemented directly
  • macro sugar: impl Trait for Self syntax — use of Self to imply struct generics and bounds, with optional extras (this may be brought to a stand-alone crate later)
  • new macro: autoimpl — more capable variant of derive (also may be brought to a stand-alone crate later)
  • fix required by recent nightly compilers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant