|
|
@@ -109,12 +109,11 @@ assert_eq!(css_url.as_str(), "http://servo.github.io/rust-url/main.css");
|
|
|
|
|
|
#[macro_use]
|
|
|
extern crate matches;
|
|
|
+extern crate idna;
|
|
|
#[cfg(feature = "serde")]
|
|
|
extern crate serde;
|
|
|
-
|
|
|
-pub extern crate idna;
|
|
|
#[macro_use]
|
|
|
-pub extern crate percent_encoding;
|
|
|
+extern crate percent_encoding;
|
|
|
|
|
|
use encoding::EncodingOverride;
|
|
|
use host::HostInternal;
|
|
|
@@ -2538,47 +2537,3 @@ impl<'a> Drop for UrlQuery<'a> {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-/// Define a new struct
|
|
|
-/// that implements the [`EncodeSet`](percent_encoding/trait.EncodeSet.html) trait,
|
|
|
-/// for use in [`percent_decode()`](percent_encoding/fn.percent_encode.html)
|
|
|
-/// and related functions.
|
|
|
-///
|
|
|
-/// Parameters are characters to include in the set in addition to those of the base set.
|
|
|
-/// See [encode sets specification](http://url.spec.whatwg.org/#simple-encode-set).
|
|
|
-///
|
|
|
-/// Example
|
|
|
-/// =======
|
|
|
-///
|
|
|
-/// ```rust
|
|
|
-/// #[macro_use] extern crate url;
|
|
|
-/// use url::percent_encoding::{utf8_percent_encode, SIMPLE_ENCODE_SET};
|
|
|
-/// define_encode_set! {
|
|
|
-/// /// This encode set is used in the URL parser for query strings.
|
|
|
-/// pub QUERY_ENCODE_SET = [SIMPLE_ENCODE_SET] | {' ', '"', '#', '<', '>'}
|
|
|
-/// }
|
|
|
-/// # fn main() {
|
|
|
-/// assert_eq!(utf8_percent_encode("foo bar", QUERY_ENCODE_SET).collect::<String>(), "foo%20bar");
|
|
|
-/// # }
|
|
|
-/// ```
|
|
|
-#[macro_export]
|
|
|
-macro_rules! define_encode_set {
|
|
|
- ($(#[$attr: meta])* pub $name: ident = [$base_set: expr] | {$($ch: pat),*}) => {
|
|
|
- $(#[$attr])*
|
|
|
- #[derive(Copy, Clone)]
|
|
|
- #[allow(non_camel_case_types)]
|
|
|
- pub struct $name;
|
|
|
-
|
|
|
- impl $crate::percent_encoding::EncodeSet for $name {
|
|
|
- #[inline]
|
|
|
- fn contains(&self, byte: u8) -> bool {
|
|
|
- match byte as char {
|
|
|
- $(
|
|
|
- $ch => true,
|
|
|
- )*
|
|
|
- _ => $base_set.contains(byte)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|