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

refactor(rust): Add FromIterator impls for PlSmallStr #18509

Merged
merged 2 commits into from
Sep 3, 2024

Conversation

nameexhaustion
Copy link
Collaborator

@nameexhaustion nameexhaustion commented Sep 2, 2024

From PlSmallStr, &PlSmallStr, and all the iterator types that String::from_iter supports

@github-actions github-actions bot added internal An internal refactor or improvement rust Related to Rust Polars labels Sep 2, 2024
@nameexhaustion nameexhaustion marked this pull request as ready for review September 2, 2024 06:22
Copy link

codecov bot commented Sep 2, 2024

Codecov Report

Attention: Patch coverage is 8.33333% with 33 lines in your changes missing coverage. Please review.

Project coverage is 79.84%. Comparing base (ab25b3e) to head (d1832fe).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
crates/polars-utils/src/pl_str.rs 8.33% 33 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18509      +/-   ##
==========================================
- Coverage   79.85%   79.84%   -0.01%     
==========================================
  Files        1501     1501              
  Lines      201829   201865      +36     
  Branches     2868     2868              
==========================================
+ Hits       161174   161189      +15     
- Misses      40109    40130      +21     
  Partials      546      546              

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

@ritchie46
Copy link
Member

I am wondering if we should. As a collect now "seems" to work, but it goes via a String allocation, which might not be that clear to the callee.

@nameexhaustion
Copy link
Collaborator Author

I am wondering if we should. As a collect now "seems" to work, but it goes via a String allocation, which might not be that clear to the callee.

I don't have any preference - though I suppose it would let us swap it out for more performant impls in the future?

@orlp might have some ideas - this was originally requested by him

@orlp
Copy link
Collaborator

orlp commented Sep 2, 2024

I mean it should be easy enough to swap the impl once we use compact_str (my suggestion for the backing crate for now).

@nameexhaustion
Copy link
Collaborator Author

I mean it should be easy enough to swap the impl once we use compact_str (my suggestion for the backing crate for now).

Ah, yes - we indeed now have native From impls provided by compact_str - have pushed a commit to update

@@ -125,7 +125,72 @@ impl From<&String> for PlSmallStr {
}
}

/// FromIterator impls (TODO)
impl From<Inner> for PlSmallStr {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

drive-by - add From<Inner>

@ritchie46 ritchie46 merged commit f5edd91 into pola-rs:main Sep 3, 2024
20 checks passed
@c-peters c-peters added the accepted Ready for implementation label Sep 3, 2024
@nameexhaustion nameexhaustion deleted the from-iter branch September 4, 2024 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation internal An internal refactor or improvement rust Related to Rust Polars
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants