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

Removes the separate no_text_values collection in Struct #430

Merged
merged 4 commits into from
Sep 27, 2022

Conversation

zslayton
Copy link
Contributor

  • Introduces the SymbolRef type, a borrowed view of a text value for field lookups.
  • Introduces the AsSymbolRef trait to allow values to be temporarily viewed as a SymbolRef.
  • Modifies the IonStruct trait to use AsSymbolRef for lookups instead of AsRef<str>. This change enables lookups for unknown text.
  • Modifies the StructRef type to use AsSymbolRef for its lookup methods.
  • Modifies the Struct type to use AsSymbolRef for its lookup methods.
  • Modifies the Struct type to store its values in a SmallVec, improving the performance of the common case. The first field value for any given field name will be stored directly in the map. If the field name is repeated, the additional values will be stored elsewhere on the heap. Prior to this change, all field values were stored on the heap in a Vec.
  • Adds len() and is_empty() methods to the Struct type. We will likely wish to move these into the IonStruct trait in the future.
  • Tweaks the ion-tests test runner to print the Ion text of the elements that caused test failures instead of using their auto-generated Debug format.

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

* Introduces the `SymbolRef` type, a borrowed view of a text
  value for field lookups.
* Introduces the `AsSymbolRef` trait to allow values to be
  temporarily viewed as a `SymbolRef`.
* Modifies the `IonStruct` trait to use `AsSymbolRef` for lookups
  instead of `AsRef<str>`. This change enables lookups for unknown
  text.
* Modifies the `StructRef` type to use `AsSymbolRef` for its lookup
  methods.
* Modifies the `Struct` type to use `AsSymbolRef` for its lookup
  methods.
* Modifies the `Struct` type to store its values in a `SmallVec`,
  improving the performance of the common case. The first field
  value for any given field name will be stored directly in the
  map. If the field name is repeated, the additional values will
  be stored elsewhere on the heap. Prior to this change, *all*
  field values were stored on the heap in a `Vec`.
* Adds `len()` and `is_empty()` methods to the `Struct` type.
  We will likely wish to move these into the `IonStruct` trait
  in the future.
* Tweaks the ion-tests test runner to print the Ion text of the
  elements that caused test failures instead of using their
  auto-generated `Debug` format.
@codecov
Copy link

codecov bot commented Sep 23, 2022

Codecov Report

Merging #430 (e58072f) into main (fb16468) will decrease coverage by 0.18%.
The diff coverage is 85.86%.

@@            Coverage Diff             @@
##             main     #430      +/-   ##
==========================================
- Coverage   83.53%   83.34%   -0.19%     
==========================================
  Files          82       83       +1     
  Lines       15526    15770     +244     
==========================================
+ Hits        12969    13143     +174     
- Misses       2557     2627      +70     
Impacted Files Coverage Δ
src/lib.rs 74.08% <ø> (-1.26%) ⬇️
src/value/mod.rs 88.86% <ø> (ø)
src/value/borrowed.rs 62.99% <81.81%> (-2.39%) ⬇️
src/value/owned.rs 74.41% <83.45%> (+0.27%) ⬆️
src/symbol_ref.rs 95.00% <95.00%> (ø)
src/reader.rs 82.09% <0.00%> (-0.31%) ⬇️
src/text/raw_text_reader.rs 90.42% <0.00%> (-0.17%) ⬇️
... and 2 more

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

src/value/borrowed.rs Show resolved Hide resolved
src/symbol_ref.rs Outdated Show resolved Hide resolved
src/value/borrowed.rs Show resolved Hide resolved
src/value/owned.rs Show resolved Hide resolved
src/value/owned.rs Show resolved Hide resolved
src/symbol_ref.rs Outdated Show resolved Hide resolved
@desaikd desaikd merged commit b16d294 into main Sep 27, 2022
@zslayton zslayton deleted the streamline-struct branch April 10, 2023 16:43
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

2 participants