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

changes Struct and StructRef implementations to consider field order #429

Merged
merged 1 commit into from
Sep 23, 2022

Conversation

desaikd
Copy link
Contributor

@desaikd desaikd commented Sep 22, 2022

Issue #200

Description of changes:
This PR changes Struct and StructRef implementations to consider field order

List of changes:

  • replaces usage of HashMap with LinkedHashMap
  • adds dependency to hashlink in Cargo.toml

Test:
Added a unit tests in mod.rs which tests operations on struct through generic trait IonElement.

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

@codecov
Copy link

codecov bot commented Sep 22, 2022

Codecov Report

Merging #429 (f96c8b3) into main (024cb2e) will increase coverage by 0.04%.
The diff coverage is 78.94%.

@@            Coverage Diff             @@
##             main     #429      +/-   ##
==========================================
+ Coverage   83.84%   83.89%   +0.04%     
==========================================
  Files          83       83              
  Lines       15532    15541       +9     
==========================================
+ Hits        13023    13038      +15     
+ Misses       2509     2503       -6     
Impacted Files Coverage Δ
src/value/owned.rs 74.14% <50.00%> (ø)
src/value/borrowed.rs 65.37% <66.66%> (+1.73%) ⬆️
src/value/mod.rs 88.86% <85.71%> (+0.02%) ⬆️
src/binary/non_blocking/binary_buffer.rs 97.04% <0.00%> (-0.25%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@@ -38,6 +38,7 @@ num-bigint = "0.3"
num-integer = "0.1.44"
num-traits = "0.2"
arrayvec = "0.7"
hashlink = "0.8.1"
Copy link
Contributor

Choose a reason for hiding this comment

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

curious how/why this particular implementation was chosen.

Copy link
Contributor

Choose a reason for hiding this comment

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

It was the confluence of a few superficial factors:

  • It was the first search result for LinkedHashMap on crates.io.
  • It had over 6 million downloads.
  • It had a few high-profile dependents, including SQLx and DuckDB.
  • It had an MIT/Apache 2.0 dual license.

image
image

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.

Looks good. We'll need to look at simplifying the definition of Struct to only have a linked hash map (i.e. remove the no_text_fields collection) in a future PR.

@zslayton zslayton merged commit 65a8dd2 into main Sep 23, 2022
@zslayton zslayton deleted the desaikd-struct-field-order branch September 23, 2022 11:52
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.

None yet

3 participants