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
Quoted pairs #68
Quoted pairs #68
Conversation
I also ran the benchmarks and there where basically no changes in performance (the new version was a bit faster but only in a degree which can be cause by noise) |
Wups, travis is still testing a quite a old rust version... I will fix this (I my code, not travis) |
It might make change to raise the minimal rust version from 1.15.0 to the first stable rust version which supports If its fine with you I would go through the crate and clean thinks a bit up after bumping |
Wow, this looks legit. I'll need a moment to review, but wanted to answer your questions: it seems that this is a breaking change, by splitting to a new For |
The rust version I would like to bump it to would be 1.18.0 as it is the first which allows Wrt. utf8 I currently consider 3 options:
The benefit of 1. is a faster comparison of utf8 but a very slightly slower comparison for any other param. The benefit of 2. is no special handling of utf8 anywhere but in the one method. The benefit of 3. is that people can create there own Patterns. |
I think it's best to go with 1. charset=utf8 is basically the most used mime parameter, so that should be fine. I also noticed that I made a mistake by assuming the PartialEq implementations for Mime use Name (now Name/Value) to compare parameters, but they don't. So I still have to fix that. I also noticed that:
Through I would leaf this for another pull request (should be combined into a single braking change). |
b3384e4
to
88e8eff
Compare
I think there is a better way to fix all this, which is to "normalize" while parsing.
This would:
I'm not sure why I didn't do that from the beginning... |
What you say sounds very reasonable! Does that mean you'd like to edit this PR more, or should I merge and you'd like to explore separately? |
I originally wanted to work a bit more on the PR. So I will now just fix the comparison of Media Types with string to use Name/Value for comparison and conclude this pull request and then continue to work on a rewriting the parser in a way which accepts parameters. Why parameters are needed: |
88e8eff
to
43da879
Compare
This required to split Name into Name & Value, as Value needs to custom implement PartialEq but Name needs to derive partial eq, as it should be usable with match statements as pattern.
So now quoted-pairs can be used for what they where meant to escape ". Some additional tests where added to make sure nothing breakes with this change.
(rust stability gurantees do not apply to crates using deny(warnings) as introducing warnings is not seen as a braking change)
Before it had been at rust 1.15.0
Adds newlines to the end of file where nessesary and removes all `eq_str` function moving their functionality into a `PartialEq<str>` implementation
0d2e902
to
06f9a75
Compare
I cleaned thinks up a bit, should now be ready to be merged. Note that I for now removed all special "utf8" (instead of utf-8) handling, |
Awesome, thank you! (Sorry, I was off the internet completely for over a week). |
I originally only wanted to add a
as_str_repr
, ato_content
method and fix equality comparsion wrt. to quoted-pairs but becauseName
was used for both names and values and names should be usable inpatterns this was not possible (to be usable in patterns
derive(PartialEq)
is required so no custom eq implementation). So I also had to split it into Name+Value.