-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Make Resource
trait opt-in, requiring #[derive(Resource)]
#5007
Changes from all commits
d1235fc
8fa3677
4f03af0
b168fe8
eb506fa
24d7c09
cbab3c1
4f74c94
b314e0a
c232410
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -480,6 +480,11 @@ pub(crate) fn bevy_ecs_path() -> syn::Path { | |
BevyManifest::default().get_path("bevy_ecs") | ||
} | ||
|
||
#[proc_macro_derive(Resource)] | ||
pub fn derive_resource(input: TokenStream) -> TokenStream { | ||
component::derive_resource(input) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this live in the component module? I guess it's fine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My argument here is that it should change in concert with the derive Component macro, so should live together. I was thinking about renaming the module, but struggled to find a clear enough blanket name. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think both components and resources can be viewed as storage. |
||
} | ||
|
||
#[proc_macro_derive(Component, attributes(component))] | ||
pub fn derive_component(input: TokenStream) -> TokenStream { | ||
component::derive_component(input) | ||
|
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.
Since it has a derive Resource, this first sentence is superfluous
However I'm happy leaving this, for a doc consistency pass at some point in the future.
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.
Yep; IMO this will be easier to do in a follow-up PR, where we can search our dev docs site for "resource" and make a call.