-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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): Unify internal string type #18425
Conversation
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] | ||
pub struct PlSmallStr(CompactString); | ||
|
||
impl PlSmallStr { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@orlp here
} | ||
} | ||
|
||
impl AsRef<str> for PlSmallStr { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add AsRef<Path>
and AsRef<[u8]>
?
crates/polars-utils/src/pl_str.rs
Outdated
} | ||
} | ||
|
||
impl From<String> for PlSmallStr { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add FromIterator<T>
for at least char
, String
and &'a str
?
ea4f56f
to
2c5332e
Compare
with_columns = Some(Arc::from(columns)); | ||
Some(name.clone()) | ||
}) | ||
.collect::<Arc<[_]>>(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drive-by refactored
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #18425 +/- ##
==========================================
- Coverage 79.86% 79.84% -0.02%
==========================================
Files 1496 1497 +1
Lines 200364 201825 +1461
Branches 2867 2867
==========================================
+ Hits 160012 161155 +1143
- Misses 39806 40124 +318
Partials 546 546 ☔ View full report in Codecov by Sentry. |
Will address remaining review points in follow-up PRs |
The merge of pola-rs#18425 accidentally reset this to 1.5.
The merge of pola-rs#18425 accidentally reset this to 1.5.
Column names, various field names, DSL / IR fields, timezone strings, etc.
Notes:
arg: PlSmallStr
- this is our owned string type, which we pass to functions that internally do things like e.g.ca.with_name(arg)
.arg: &PlSmallStr
- micro-optimization for functions that don't always clone, this is very rare - usually&str
is used insteadarg: &str
- the usual rust function that doesn't need owned strings, call-sites to these functions that haves: PlSmallStr
s will often uses.as_str()
.