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

feat(generator/rust): improve setters #844

Merged
merged 2 commits into from
Jan 27, 2025

Conversation

coryan
Copy link
Contributor

@coryan coryan commented Jan 24, 2025

The setters for Vec<T> fields now consume a IntoIterator<Item = V> where
V implements Into<T>. Similarly, the setters for HashMap<K, V> fields
consume a IntoIterator<Item = (KI, VI)> where KI and VI do what you
expect.

I changed the integration tests to take advantage of this change.

Since I was changing all the setters, I also updated their comments to directly
link the field they are changing. That makes it easier to navigate to a
description of the field.

Fixes #627 and fixes #461. Related to #460.

Copy link

codecov bot commented Jan 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.57%. Comparing base (58e7ff8) to head (d78f04e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #844   +/-   ##
=======================================
  Coverage   95.57%   95.57%           
=======================================
  Files          36       36           
  Lines        1357     1357           
=======================================
  Hits         1297     1297           
  Misses         60       60           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@coryan coryan marked this pull request as ready for review January 24, 2025 23:48
@coryan coryan requested review from codyoss and mpeddada1 January 24, 2025 23:53
The setters for `Vec<T>` fields now consume a `IntoIterator<Item = V>` where
`V` implements `Into<T>`.  Similarly, the setters for `HashMap<K, V>` fields
consume a `IntoIterator<Item = (KI, VI)>` where `KI` and `VI` do what you
expect.

I changed the integration tests to take advantage of this change.

Since I was changing all the setters, I also updated their comments to directly
link the field they are changing. That makes it easier to navigate to a
description of the field.
@coryan coryan force-pushed the feat-generator-rust-into-iterator branch from 958d517 to d78f04e Compare January 27, 2025 15:30
@coryan coryan enabled auto-merge (squash) January 27, 2025 15:30
@coryan coryan merged commit 2279453 into googleapis:main Jan 27, 2025
15 checks passed
@coryan coryan deleted the feat-generator-rust-into-iterator branch January 27, 2025 15:57
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.

Builder documentation should link the fields being set Use IntoIterator<> for Vec and HashMap setters
2 participants