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

feat: add #[default] attribute to LdtkEntity and LdtkIntCell derive macros #306

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

neocturne
Copy link
Contributor

Add an attribute that initializes fields using individual field Default implementations, allowing to use the derive macros again without requiring the whole struct to implement Default (when some fields should be default-initialized and others use initialization attributes like #[from_entity_instance]).

Fixes #305

…acros

Add an attribute that initializes fields using individual field Default
implementations, allowing to use the derive macros again without
requiring the whole struct to implement Default (when some fields should
be default-initialized and others use initialization attributes
like #[from_entity_instance]).

Fixes Trouv#305
Copy link
Owner

@Trouv Trouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm suddenly remembering why I originally made the plugin use the field's Default instead of the bundle's. I think this is a great compromise, thanks for your work/design on it. I only have a few docs-related suggestions

src/app/ldtk_entity.rs Outdated Show resolved Hide resolved
src/app/ldtk_entity.rs Outdated Show resolved Hide resolved
src/app/ldtk_int_cell.rs Outdated Show resolved Hide resolved
Co-authored-by: Trevor Lovell <trevorlovelldesign@gmail.com>
@neocturne
Copy link
Contributor Author

Is this PR still missing anything?

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.

#[ldtk_int_cell], #[from_entity_instance] etc. should not require a Default impl
2 participants