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

keep existing values when extending dictionary #322

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

SebRollen
Copy link
Contributor

@SebRollen SebRollen commented Sep 10, 2024

Currently, calling extend on a Dictionary clears out any existing values in the dictionary. This PR reworks the method to keep existing entries, while merging in new entries from other.

This better matches the semantics of the Extend trait, specifically:

When extending a collection with an already existing key, that entry is updated or, in the case of collections that permit multiple entries with equal keys, that entry is inserted.

Fixes #120
Fixes #246

@J-F-Liu J-F-Liu merged commit f6035f7 into J-F-Liu:master Sep 12, 2024
8 checks passed
@SebRollen SebRollen deleted the extend-dictionary branch September 12, 2024 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants