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

Put encoding_rs dependency behind a Cargo feature? #1785

Closed
talagrand opened this issue Mar 18, 2023 · 3 comments · Fixed by #2175
Closed

Put encoding_rs dependency behind a Cargo feature? #1785

talagrand opened this issue Mar 18, 2023 · 3 comments · Fixed by #2175
Labels
B-breaking-change Blocked: breaking change. B-rfc Blocked: Request for comments. More discussion would help move this along.
Milestone

Comments

@talagrand
Copy link

I'm doing binary size analysis of my release binary using Size Bench: https://devblogs.microsoft.com/performance-diagnostics/sizebench-a-new-tool-for-analyzing-windows-binary-size/
A significant contributor to the size of the .rdata section is encoding_rs's data tables: https://raw.githubusercontent.com/hsivonen/encoding_rs/master/src/data.rs
It would be nice to place the dependency on encoding_rs behind a Cargo feature to avoid this size increase, e.g. in cases where Reqwest is used only to consume binary data or REST endpoints that speak utf-8.

@seanmonstar seanmonstar added B-rfc Blocked: Request for comments. More discussion would help move this along. B-breaking-change Blocked: breaking change. labels Mar 20, 2023
@seanmonstar
Copy link
Owner

seanmonstar commented Mar 20, 2023

Sounds potentially useful for when we do the next breaking change!

At the same time, I suspect calling .text() to be very common, and I wonder how surprising it would be that it's not available by default.

@Xuanwo
Copy link
Contributor

Xuanwo commented Apr 27, 2023

At the same time, I suspect calling .text() to be very common, and I wonder how surprising it would be that it's not available by default.

Perhaps we could include encoding_rs as a default feature, allowing users to disable it if they prefer to handle all content in bytes.

@seanmonstar seanmonstar added this to the 0.12 milestone Feb 26, 2024
Marwes added a commit to Marwes/reqwest that referenced this issue Mar 13, 2024
I believe this should be equivalent.

Closes seanmonstar#1785
Marwes added a commit to Marwes/reqwest that referenced this issue Mar 13, 2024
Keeping it as a default feature so that the default user experience isn't to be confused about the lack of `text`. It is possible that `text` (but not `text_with_charset`) exists without the `encoding_rs` feature by only trying to decode the response as utf-8 in that case. However that would mean that the behaviour changes if the feature is later added since the method would start to respect `Content-Type` then.

Closes seanmonstar#1785
Marwes added a commit to Marwes/reqwest that referenced this issue Mar 13, 2024
Keeping it as a default feature so that the default user experience isn't to be confused about the lack of `text`. It is possible that `text` (but not `text_with_charset`) exists without the `encoding_rs` feature by only trying to decode the response as utf-8 in that case. However that would mean that the behaviour changes if the feature is later added since the method would start to respect `Content-Type` then.

Closes seanmonstar#1785
Marwes added a commit to Marwes/reqwest that referenced this issue Mar 13, 2024
Keeping it as a default feature so that the default user experience isn't to be confused about the lack of `text`. It is possible that `text` (but not `text_with_charset`) exists without the `encoding_rs` feature by only trying to decode the response as utf-8 in that case. However that would mean that the behaviour changes if the feature is later added since the method would start to respect `Content-Type` then.

Closes seanmonstar#1785
Marwes added a commit to Marwes/reqwest that referenced this issue Mar 13, 2024
Keeping it as a default feature so that the default user experience isn't to be confused about the lack of `text`. It is possible that `text` (but not `text_with_charset`) exists without the `encoding_rs` feature by only trying to decode the response as utf-8 in that case. However that would mean that the behaviour changes if the feature is later added since the method would start to respect `Content-Type` then.

Closes seanmonstar#1785
Marwes added a commit to Marwes/reqwest that referenced this issue Mar 19, 2024
I believe this should be equivalent.

Closes seanmonstar#1785
Marwes added a commit to Marwes/reqwest that referenced this issue Mar 19, 2024
I believe this should be equivalent.

Closes seanmonstar#1785
Marwes added a commit to Marwes/reqwest that referenced this issue Mar 19, 2024
I believe this should be equivalent.

Closes seanmonstar#1785
seanmonstar pushed a commit that referenced this issue Mar 19, 2024
I believe this should be equivalent.

Closes #1785
seanmonstar pushed a commit that referenced this issue Mar 19, 2024
I believe this should be equivalent.

Closes #1785
@seanmonstar
Copy link
Owner

Done in #2175, will be part of 0.12 soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-breaking-change Blocked: breaking change. B-rfc Blocked: Request for comments. More discussion would help move this along.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants