We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Bundle
0.5
Debian GNU/Linux "buster"
Tried to derive Bundle for a struct containing a type with generic parameters:
#[derive(Bundle)] struct Bar<T: bevy::ecs::component::Component> { f: T, } #[derive(Bundle)] struct Foo { #[bundle] bar: Bar<String>, }
I should get a Bundle implementation for Foo that includes Bar as a sub-bundle.
Foo
Bar
The code produced by the macro fails to compile:
error: comparison operators cannot be chained --> src/main.rs:13:13 | 13 | bar: Bar<String>, | ^ ^ | help: use `::<...>` instead of `<...>` to specify type or const arguments | 13 | bar: Bar::<String>, | ^^ error: proc-macro derive produced unparseable tokens --> src/main.rs:10:10 | 10 | #[derive(Bundle)] | ^^^^^^ error: aborting due to 2 previous errors
Using a type alias is a workaround:
#[derive(Bundle)] struct Bar<T: bevy::ecs::component::Component> { f: T, } type BarString = Bar<String>; #[derive(Bundle)] struct Foo { #[bundle] bar: BarString, }
(edited to remove an unrelated bug from my example code and add the workaround)
The text was updated successfully, but these errors were encountered:
While another issue awaits some clarification on change from Carter, I can take this one.
Sorry, something went wrong.
2231492
Angle bracket annotated types to support generics (bevyengine#1919)
251ef82
Fixes bevyengine#1873. Types should be enclosed in angular brackets to avoid ambiquity and to correctly resolve associated functions.
YohDeadfall
Successfully merging a pull request may close this issue.
Bevy version
0.5
Operating system & version
Debian GNU/Linux "buster"
What you did
Tried to derive
Bundle
for a struct containing a type with generic parameters:What you expected to happen
I should get a
Bundle
implementation forFoo
that includesBar
as a sub-bundle.What actually happened
The code produced by the macro fails to compile:
Additional information
Using a type alias is a workaround:
(edited to remove an unrelated bug from my example code and add the workaround)
The text was updated successfully, but these errors were encountered: