Skip to content

Conversation

@tomoikey
Copy link
Owner

@tomoikey tomoikey commented Aug 8, 2025

Closes #6

Summary

  • Add support for bare #[builder(default)] attribute that uses Default::default()
  • Maintain backward compatibility with existing #[builder(default = "expression")] syntax
  • Implement DefaultValue enum to handle both cases

Changes

  • Created DefaultValue enum to distinguish between bare defaults and expression defaults
  • Updated parser to recognize #[builder(default)] without value using darling::FromMeta
  • Modified code generation to use Default::default() for bare attributes
  • Added comprehensive test coverage for new functionality

Relates to

#6

@tomoikey tomoikey changed the title feat: add support for #[builder(default)] attribute without expression feat: add support for #[builder(default)] attribute without expression Aug 8, 2025
@tomoikey tomoikey merged commit 5726a52 into main Aug 16, 2025
1 check passed
@tomoikey tomoikey deleted the feat/enhance_default branch August 16, 2025 03:57
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.

Allow optional fields for types that implement Default

1 participant