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 #[inspect(..)] attributes #4

Open
5 of 10 tasks
toyboot4e opened this issue Sep 19, 2021 · 0 comments
Open
5 of 10 tasks

Add #[inspect(..)] attributes #4

toyboot4e opened this issue Sep 19, 2021 · 0 comments

Comments

@toyboot4e
Copy link
Owner

toyboot4e commented Sep 19, 2021

Derive macros can accept type/field attributes in the syntax #[attr(name = value)].
Let's add desired attributes to the Inspect macro!

Override

Manual

  • #[inspect(with = "<function>")] (overriding inspection)
  • #[inspect(default = ..)] (overriding enum variant default value on enum tag switch)

Shortcut

  • #[inspect(as = "<type>")] (Into / From conversion)
  • Via serde? (T → String → T, etc.)

Widget

  • #[inspect(open = <bool>)]: (default open state of node)
  • #[inspect_slider(min = "-50.0", max = "50.0")]

Options

Enum

  • #[inspect(no_tag)] to disable tag selector (just show current tag)
  • #[inspect(skip)] over variants

Options

  • #[inspect(read_only)]
  • #[inspect(skip)]
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

No branches or pull requests

1 participant