Skip to content

Adds Bag type #240

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

Merged
merged 2 commits into from
Mar 18, 2025
Merged

Adds Bag type #240

merged 2 commits into from
Mar 18, 2025

Conversation

popematt
Copy link
Contributor

Issue #, if available:

#228
Suggested in #238 (comment)

Description of changes:

Adds a naive Bag implementation and switches ValidValues, AnyOf, OneOf, AllOf, and TypeDefinition to use rather than having them all sort their own Vec or have incorrect equality.

I tried to minimize the diff as best as I could. The interesting changes are entirely in bag.rs. The rest of the changes are switching vec -> bag, updating related comments, and updating some constructor signatures.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Contributor

@zslayton zslayton left a comment

Choose a reason for hiding this comment

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

Some clippy warnings to look at before merging.

/// and unsupported. Any modifications should be done by trivially converting to a `Vec`, applying
/// the modifications, and then converting back to a `Bag`.
///
/// TODO: Replace the vec with a HashBag or come up with a less hacky way to sort the type arguments.
Copy link
Contributor

Choose a reason for hiding this comment

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

Outdated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really. I'd like to come up with a less naive approach because using Debug as the sort key works by coincidence rather than by design.

@popematt popematt merged commit 2439252 into amazon-ion:dev-1.0.0 Mar 18, 2025
3 checks passed
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.

2 participants