-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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 IterableEnum
trait
#7269
Add IterableEnum
trait
#7269
Conversation
One thing i want to resolve before this gets merged: |
crates/bevy_utils/macros/Cargo.toml
Outdated
[dependencies] | ||
syn = { version = "1.0", features = ["full", "parsing", "extra-traits"] } | ||
quote = "1.0" | ||
bevy_macro_utils = { version = "0.9.0", path = "../../bevy_macro_utils" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really confusing to now have both bevy_macro_utils
and bevy_utils_macros
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already thought about that on discord. But no answer from Alice yet
|
||
use crate::paths; | ||
|
||
pub fn parse_iterable_enum_derive(input: TokenStream) -> TokenStream { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of a get_at
, could we not just generate a const SLICE: &[Self]
in the trait?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty smart idea. I’ll try
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we lose the trait altogether and just generate an associated const on the type itself?
crates/bevy_utils/Cargo.toml
Outdated
@@ -13,7 +13,8 @@ ahash = "0.7.0" | |||
tracing = { version = "0.1", default-features = false, features = ["std"] } | |||
instant = { version = "0.1", features = ["wasm-bindgen"] } | |||
uuid = { version = "1.1", features = ["v4", "serde"] } | |||
hashbrown = { version = "0.12", features = ["serde"] } | |||
hashbrown = { version = "0.12.3", features = ["serde"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hashbrown = { version = "0.12.3", features = ["serde"] } | |
hashbrown = { version = "0.12", features = ["serde"] } |
Co-authored-by: James Liu <contact@jamessliu.com>
We could add a |
Co-authored-by: James Liu <contact@jamessliu.com>
Yes please. |
Co-authored-by: James Liu <contact@jamessliu.com>
I’ll try to understand how it works for bundles and then try it 😁 |
Why not use an existing one? For example https://crates.io/crates/enum-iterator |
That would be too easy 🤧 |
@alice-i-cecile what do you think? |
Then I'm definitely against this PR, even more so as it adds a new crate |
Should i convert this PR to a |
I don't know, there are no details on why this macro is needed 🤷 |
alice had it on her todos and i asked if i could do it. the macro was planned all the time. but a crate will be better yes. now should i just close the PR or migrate my "code" to the crate? |
I must say I don't see the link between stageless schedule and being able to iterate on |
alice just threw it out in the conversation |
Closing in favor of |
Alright, I'm on board. We can use |
Objective
Required from #7267
Solution
Changelog
IterableEnum
trait and deriveEnumIterator
iterator