docs: add section explaining attributes and automatic Clone/Copy derives - #13
Merged
Merged
Conversation
- Add new 'Attributes and Derives' section to README - Explain that user attributes are applied to both main type and fields struct - Document that Clone and Copy are automatically derived - Update all examples to remove manual Clone, Copy derives - Add examples showing how to derive additional traits like serde Co-authored-by: openhands <openhands@all-hands.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds documentation to the README explaining how attributes are handled in the
#[bitpiece]macro, following the changes made in commit 8e685a1.Changes
New "Attributes and Derives" Section
Added a new section to the README that explains:
Attribute propagation: User-provided attributes (like
#[derive(...)]) are now applied to both the main generated type and the generated fields struct (whenfields_structis enabled).Automatic Clone and Copy: The
CloneandCopytraits are automatically derived on all bitpiece types. Users do not need to (and should not) manually derive these traits.Deriving additional traits: Examples showing how to derive additional traits like
Debug,PartialEq,Eq,Hash, and third-party traits like serde.Updated Examples
All code examples throughout the README have been updated to remove
Clone, Copyfrom the#[derive(...)]attributes, reflecting the new automatic derivation behavior.Related
This documentation follows the changes made in PR #12 (commit 8e685a1) which changed how attributes are handled in the macros.
@roeeshoshani can click here to continue refining the PR