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

(not for merge, discussion comments) enum discriminant de- and serialization behavior #148

Closed
wants to merge 35 commits into from

Conversation

iho
Copy link
Contributor

@iho iho commented Jun 9, 2023

Addressing #138 (comment)

Resolves #147

@iho iho requested a review from frol as a code owner June 9, 2023 13:00
borsh/tests/test_simple_structs.rs Outdated Show resolved Hide resolved
borsh/tests/test_simple_structs.rs Outdated Show resolved Hide resolved
borsh-derive/src/lib.rs Outdated Show resolved Hide resolved
borsh/Cargo.toml Outdated Show resolved Hide resolved
borsh-derive-internal/src/enum_ser.rs Outdated Show resolved Hide resolved
borsh-derive-internal/src/enum_discriminant_map.rs Outdated Show resolved Hide resolved
borsh-derive/src/lib.rs Outdated Show resolved Hide resolved
borsh-derive/src/lib.rs Outdated Show resolved Hide resolved
borsh-derive/src/lib.rs Outdated Show resolved Hide resolved
borsh/tests/test_de_errors.rs Outdated Show resolved Hide resolved
@frol
Copy link
Collaborator

frol commented Jun 15, 2023

@iho Please, add tests to cover #148 (comment)

borsh-derive/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@frol frol left a comment

Choose a reason for hiding this comment

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

borsh-derive-internal/src/enum_discriminant_map.rs Outdated Show resolved Hide resolved
borsh-derive-internal/src/enum_de.rs Outdated Show resolved Hide resolved
borsh-derive/src/lib.rs Outdated Show resolved Hide resolved
borsh-derive-internal/src/enum_de.rs Outdated Show resolved Hide resolved
borsh-derive/src/lib.rs Outdated Show resolved Hide resolved
borsh/tests/test_simple_structs.rs Outdated Show resolved Hide resolved
@frol frol mentioned this pull request Jul 5, 2023
24 tasks
@iho iho requested a review from dj8yfo as a code owner July 9, 2023 14:21
@iho iho force-pushed the iho_enum_discriminant_attr_macros branch from 650bab0 to 2c2cb64 Compare July 9, 2023 16:34
Copy link
Collaborator

@frol frol left a comment

Choose a reason for hiding this comment

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

Overall, looks good to me, but I delegate the final review and merge this PR to @dj8yfo

borsh-derive/src/lib.rs Outdated Show resolved Hide resolved
borsh-derive/src/lib.rs Outdated Show resolved Hide resolved
borsh-derive/src/lib.rs Outdated Show resolved Hide resolved
@iho
Copy link
Contributor Author

iho commented Jul 12, 2023

@dj8yfo done. Please look again

@iho iho requested a review from dj8yfo July 12, 2023 08:58
borsh-derive-internal/src/attribute_helpers.rs Outdated Show resolved Hide resolved
borsh-derive-internal/Cargo.toml Outdated Show resolved Hide resolved
borsh-derive/src/lib.rs Outdated Show resolved Hide resolved
borsh-derive-internal/src/attribute_helpers.rs Outdated Show resolved Hide resolved
borsh-derive-internal/src/attribute_helpers.rs Outdated Show resolved Hide resolved
borsh-derive-internal/src/enum_ser.rs Show resolved Hide resolved
borsh-derive-internal/src/enum_de.rs Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
borsh-derive-internal/src/attribute_helpers.rs Outdated Show resolved Hide resolved
borsh-derive-internal/src/attribute_helpers.rs Outdated Show resolved Hide resolved
borsh-derive-internal/src/attribute_helpers.rs Outdated Show resolved Hide resolved
borsh/tests/test_simple_structs.rs Show resolved Hide resolved
borsh/tests/test_simple_structs.rs Show resolved Hide resolved
borsh/tests/test_simple_structs.rs Show resolved Hide resolved
borsh-derive-internal/src/enum_de.rs Outdated Show resolved Hide resolved
borsh-derive-internal/src/enum_ser.rs Outdated Show resolved Hide resolved
borsh-derive-internal/src/enum_de.rs Outdated Show resolved Hide resolved
@iho iho closed this Jul 27, 2023
@dj8yfo
Copy link
Collaborator

dj8yfo commented Jul 27, 2023

reopening to check resolution of comments, not for merge

@dj8yfo dj8yfo reopened this Jul 27, 2023
@dj8yfo dj8yfo changed the title Add borsh macros that change enum discriminant de- and serialization behavior (not for merge, discussion comments) enum discriminant de- and serialization behavior Jul 27, 2023
@dj8yfo dj8yfo marked this pull request as draft July 27, 2023 12:39
@dj8yfo
Copy link
Collaborator

dj8yfo commented Jul 28, 2023

closing as all comments have either been resolved or moved to #183

@dj8yfo dj8yfo closed this Jul 28, 2023
dj8yfo added a commit that referenced this pull request Jul 31, 2023
… behavior #148 (#183)

* WIP

* Update insta snapshots

* clippy

* clippy

* Add documentation

* remove debug prints; add documentation

* fix doc

* remove debug print

* Apply suggestions from code review

Co-authored-by: dj8yf0μl <26653921+dj8yfo@users.noreply.github.com>

* Add test; bump Rust version in CI; fix typos

* refactoring

* Apply suggestion for check_item_attributes

* Add docs for

* remove comment; add documentation

* clippy

* replace panic in macros to explicit error

* Apply suggestions from code review

Co-authored-by: dj8yf0μl <26653921+dj8yfo@users.noreply.github.com>

* fix test

* Fix comments; Add suggested tests

* Add documentation; Bump Rust compiler version

* Apply suggestions from code review

Co-authored-by: dj8yf0μl <26653921+dj8yfo@users.noreply.github.com>

* Fix tests

* Fix test; clippy

* Apply suggestions from code review

Co-authored-by: dj8yf0μl <26653921+dj8yfo@users.noreply.github.com>

* Move enum related tests to separate file

* fix doc CI

* docs: Update "Enum with explicit discriminant" README.md

* fix(ci): conditional downgrade of time for older toolchain

* ci: fixed the condition on when to downgrade `time` crate in CI workflow

* Fix English in doc

* chore: revert unneeded imports reordering

* chore: duplicate `if let Err(...)` instead of `match`

---------

Co-authored-by: dj8yf0μl <26653921+dj8yfo@users.noreply.github.com>
Co-authored-by: Vlad Frolov <frolvlad@gmail.com>
Co-authored-by: dj8yf0μl <sffhox@gmail.com>
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.

Introduce a required #[borsh(use_discriminant = true|false)] enum attribute when discriminants are specified
4 participants