Explorar o código

Make some details of the idna module private.

Simon Sapin %!s(int64=10) %!d(string=hai) anos
pai
achega
56f8eb2a5b
Modificáronse 4 ficheiros con 7 adicións e 12 borrados
  1. 1 4
      make_idna_table.py
  2. 5 3
      src/idna.rs
  3. 1 4
      src/idna_mapping.rs
  4. 0 1
      src/lib.rs

+ 1 - 4
make_idna_table.py

@@ -22,10 +22,7 @@ print('''\
 
 // Generated by make_idna_table.py
 
-use idna::Mapping::*;
-use idna::Range;
-
-pub static TABLE: &'static [Range] = &[
+static TABLE: &'static [Range] = &[
 ''')
 
 txt = open("IdnaMappingTable.txt")

+ 5 - 3
src/idna.rs

@@ -2,15 +2,17 @@
 //!
 //! https://url.spec.whatwg.org/#idna
 
-use idna_mapping::TABLE;
+use self::Mapping::*;
 use punycode;
 use std::ascii::AsciiExt;
 use unicode_normalization::UnicodeNormalization;
 use unicode_normalization::char::is_combining_mark;
 use unicode_bidi::{BidiClass, bidi_class};
 
+include!("idna_mapping.rs");
+
 #[derive(Debug)]
-pub enum Mapping {
+enum Mapping {
     Valid,
     Ignored,
     Mapped(&'static str),
@@ -20,7 +22,7 @@ pub enum Mapping {
     DisallowedStd3Mapped(&'static str),
 }
 
-pub struct Range {
+struct Range {
     pub from: char,
     pub to: char,
     pub mapping: Mapping,

+ 1 - 4
src/idna_mapping.rs

@@ -8,10 +8,7 @@
 
 // Generated by make_idna_table.py
 
-use idna::Mapping::*;
-use idna::Range;
-
-pub static TABLE: &'static [Range] = &[
+static TABLE: &'static [Range] = &[
 
     Range { from: '\0', to: ',', mapping: DisallowedStd3Valid },
     Range { from: '-', to: '.', mapping: Valid },

+ 0 - 1
src/lib.rs

@@ -173,7 +173,6 @@ pub mod form_urlencoded;
 pub mod punycode;
 pub mod format;
 pub mod idna;
-mod idna_mapping;
 
 /// The parsed representation of an absolute URL.
 #[derive(PartialEq, Eq, Clone, Debug, Hash, PartialOrd, Ord)]