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

Fix for rust commit 3dcd2157403163789aaf21a9ab3c4d30a7c6494d 'Switch to ... #47

Merged
merged 2 commits into from Nov 18, 2014

Conversation

@CraZySacX
Copy link
Contributor

CraZySacX commented Nov 18, 2014

...purely namespaced enums'

…to purely namespaced enums'
@tari
Copy link

tari commented Nov 18, 2014

Since lifthrasiir/rust-encoding#60 landed, some names from encoding changed too. The following patch fixes compilation against the new names.

diff --git a/src/form_urlencoded.rs b/src/form_urlencoded.rs
index 6e177e0..87556b8 100644
--- a/src/form_urlencoded.rs
+++ b/src/form_urlencoded.rs
@@ -81,7 +81,7 @@ pub fn parse_bytes(input: &[u8], encoding_override: Option<EncodingRef>,
     fn decode(input: Vec<u8>, encoding_override: EncodingRef) -> String {
         encoding_override.decode(
             percent_decode(input.as_slice()).as_slice(),
-            encoding::DecodeReplace).unwrap()
+            encoding::DecoderTrap::Replace).unwrap()
     }

     Some(pairs.into_iter().map(
@@ -115,7 +115,7 @@ pub fn serialize<'a, I: Iterator<(&'a str, &'a str)>>(
         let input = match encoding_override {
             None => input.as_bytes(),  // "Encode" to UTF-8
             Some(encoding) => {
-                keep_alive = encoding.encode(input, encoding::EncodeNcrEscape).unwrap();
+                keep_alive = encoding.encode(input, encoding::EncoderTrap::NcrEscape).unwrap();
                 keep_alive.as_slice()
             }
         };
diff --git a/src/parser.rs b/src/parser.rs
index 2a6c5e0..af09285 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -653,7 +653,7 @@ pub fn parse_query<'a>(input: &'a str, context: Context, parser: &UrlParser)
     let encoded;
     let query_bytes = match parser.query_encoding_override {
         Some(encoding) => {
-            encoded = encoding.encode(query.as_slice(), encoding::EncodeReplace).unwrap();
+            encoded = encoding.encode(query.as_slice(), encoding::EncoderTrap::Replace).unwrap();
             encoded.as_slice()
         },
         None => query.as_bytes()  // UTF-8
@SimonSapin
Copy link
Member

SimonSapin commented Nov 18, 2014

I’m gonna do some refactoring to take advantage of the new behavior (read: breaking changes coming!), but I’ll start by taking this anyway. Thanks!

SimonSapin added a commit that referenced this pull request Nov 18, 2014
Fix for rust commit 3dcd2157403163789aaf21a9ab3c4d30a7c6494d 'Switch to ...
@SimonSapin SimonSapin merged commit c3d32da into servo:master Nov 18, 2014
1 check failed
1 check failed
continuous-integration/travis-ci The Travis CI build failed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.