[librsvg: 4/5] attributes.rs: Removed, along with the dependency for phf



commit 5a361dfa1ed55b970ec960ba2513a7ef761819ec
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue May 14 20:08:50 2019 -0500

    attributes.rs: Removed, along with the dependency for phf

 Cargo.lock                       |  11 +--
 Makefile.am                      |   1 -
 rsvg_internals/Cargo.toml        |   3 -
 rsvg_internals/build.rs          | 191 ---------------------------------------
 rsvg_internals/src/attributes.rs |  52 -----------
 rsvg_internals/src/lib.rs        |   1 -
 6 files changed, 5 insertions(+), 254 deletions(-)
---
diff --git a/Cargo.lock b/Cargo.lock
index 1bb70d36..f1e4aa03 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -99,7 +99,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index";
 
 [[package]]
 name = "cfg-if"
-version = "0.1.7"
+version = "0.1.9"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 
 [[package]]
@@ -171,7 +171,7 @@ version = "0.3.1"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
  "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
- "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
  "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -184,7 +184,7 @@ name = "crossbeam-utils"
 version = "0.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
- "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -526,7 +526,7 @@ name = "log"
 version = "0.4.6"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
- "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -984,7 +984,6 @@ dependencies = [
  "pango-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "pangocairo 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)",
- "phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)",
  "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1257,7 +1256,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index";
 "checksum cairo-rs 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"9e09d8a818b2ccc8983f04d95a9350c3cf8d24cc456cedca3b88fa3a81fdc0e2"
 "checksum cairo-sys-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"b3fa13914fdc013387afa771f554f2f71d6ae931f4e5be9246c337d60c3dc484"
 "checksum cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = 
"926013f2860c46252efceabb19f4a6b308197505082c609025aa6706c011d427"
-"checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = 
"11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4"
+"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = 
"b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33"
 "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
 "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = 
"ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
 "checksum criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = 
"0363053954f3e679645fc443321ca128b7b950a6fe288cf5f9335cc22ee58394"
diff --git a/Makefile.am b/Makefile.am
index 2391de4a..046c7f17 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -32,7 +32,6 @@ RUST_SRC =                                                    \
        rsvg_internals/src/allowed_url.rs                       \
        rsvg_internals/src/angle.rs                             \
        rsvg_internals/src/aspect_ratio.rs                      \
-       rsvg_internals/src/attributes.rs                        \
        rsvg_internals/src/bbox.rs                              \
        rsvg_internals/src/c_api.rs                             \
        rsvg_internals/src/clip_path.rs                         \
diff --git a/rsvg_internals/Cargo.toml b/rsvg_internals/Cargo.toml
index 04d4c8a1..394ca837 100644
--- a/rsvg_internals/Cargo.toml
+++ b/rsvg_internals/Cargo.toml
@@ -17,9 +17,6 @@ edition = "2018"
 # regenerate librsvg/Cargo.lock, and copy the resolved version numbers
 # from there into cargo-fetcher/Cargo.toml.
 
-[build-dependencies]
-phf_codegen = "0.7.21"
-
 [dependencies]
 bitflags = "1.0"
 cairo-rs = { version="0.6.0", features=["v1_16"] }
diff --git a/rsvg_internals/build.rs b/rsvg_internals/build.rs
index 7b69b74e..b30fac62 100644
--- a/rsvg_internals/build.rs
+++ b/rsvg_internals/build.rs
@@ -1,203 +1,12 @@
-use phf_codegen;
-
 use std::env;
 use std::fs::File;
 use std::io::{BufWriter, Write};
 use std::path::Path;
 
 fn main() {
-    generate_phf_of_svg_attributes();
     generate_srgb_tables();
 }
 
-/// Creates a perfect hash function (PHF) to map SVG attribute names to enum values.
-fn generate_phf_of_svg_attributes() {
-    // (attribute name, Rust enum value)
-    //
-    #[cfg_attr(rustfmt, rustfmt_skip)]
-    let attribute_defs = [
-        ( "alternate",          "Alternate" ),
-        ( "amplitude",          "Amplitude" ),
-        ( "azimuth",            "Azimuth" ),
-        ( "baseFrequency",      "BaseFrequency" ),
-        ( "baseline-shift",     "BaselineShift" ),
-        ( "bias",               "Bias" ),
-        ( "class",              "Class" ),
-        ( "clip-path",          "ClipPath" ),
-        ( "clip-rule",          "ClipRule" ),
-        ( "clipPathUnits",      "ClipPathUnits" ),
-        ( "color",              "Color" ),
-        ( "color-interpolation-filters", "ColorInterpolationFilters" ),
-        ( "cx",                 "Cx" ),
-        ( "cy",                 "Cy" ),
-        ( "d",                  "D" ),
-        ( "diffuseConstant",    "DiffuseConstant" ),
-        ( "direction",          "Direction" ),
-        ( "display",            "Display" ),
-        ( "divisor",            "Divisor" ),
-        ( "dx",                 "Dx" ),
-        ( "dy",                 "Dy" ),
-        ( "edgeMode",           "EdgeMode" ),
-        ( "elevation",          "Elevation" ),
-        ( "enable-background",  "EnableBackground" ),
-        ( "encoding",           "Encoding" ),
-        ( "exponent",           "Exponent" ),
-        ( "fill",               "Fill" ),
-        ( "fill-opacity",       "FillOpacity" ),
-        ( "fill-rule",          "FillRule" ),
-        ( "filter",             "Filter" ),
-        ( "filterUnits",        "FilterUnits" ),
-        ( "flood-color",        "FloodColor" ),
-        ( "flood-opacity",      "FloodOpacity" ),
-        ( "font-family",        "FontFamily" ),
-        ( "font-size",          "FontSize" ),
-        ( "font-stretch",       "FontStretch" ),
-        ( "font-style",         "FontStyle" ),
-        ( "font-variant",       "FontVariant" ),
-        ( "font-weight",        "FontWeight" ),
-        ( "fx",                 "Fx" ),
-        ( "fy",                 "Fy" ),
-        ( "gradientTransform",  "GradientTransform" ),
-        ( "gradientUnits",      "GradientUnits" ),
-        ( "height",             "Height" ),
-        ( "href",               "Href" ),
-        ( "id",                 "Id" ),
-        ( "in",                 "In" ),
-        ( "in2",                "In2" ),
-        ( "intercept",          "Intercept" ),
-        ( "k1",                 "K1" ),
-        ( "k2",                 "K2" ),
-        ( "k3",                 "K3" ),
-        ( "k4",                 "K4" ),
-        ( "kernelMatrix",       "KernelMatrix" ),
-        ( "kernelUnitLength",   "KernelUnitLength" ),
-        ( "letter-spacing",     "LetterSpacing" ),
-        ( "lighting-color",     "LightingColor" ),
-        ( "limitingConeAngle",  "LimitingConeAngle" ),
-        ( "marker",             "Marker" ),
-        ( "marker-end",         "MarkerEnd" ),
-        ( "marker-mid",         "MarkerMid" ),
-        ( "marker-start",       "MarkerStart" ),
-        ( "markerHeight",       "MarkerHeight" ),
-        ( "markerUnits",        "MarkerUnits" ),
-        ( "markerWidth",        "MarkerWidth" ),
-        ( "mask",               "Mask" ),
-        ( "maskContentUnits",   "MaskContentUnits" ),
-        ( "maskUnits",          "MaskUnits" ),
-        ( "mode",               "Mode" ),
-        ( "numOctaves",         "NumOctaves" ),
-        ( "offset",             "Offset" ),
-        ( "opacity",            "Opacity" ),
-        ( "operator",           "Operator" ),
-        ( "order",              "Order" ),
-        ( "orient",             "Orient" ),
-        ( "overflow",           "Overflow" ),
-        ( "parse",              "Parse" ),
-        ( "path",               "Path" ),
-        ( "patternContentUnits", "PatternContentUnits" ),
-        ( "patternTransform",   "PatternTransform" ),
-        ( "patternUnits",       "PatternUnits" ),
-        ( "points",             "Points" ),
-        ( "pointsAtX",          "PointsAtX" ),
-        ( "pointsAtY",          "PointsAtY" ),
-        ( "pointsAtZ",          "PointsAtZ" ),
-        ( "preserveAlpha",      "PreserveAlpha" ),
-        ( "preserveAspectRatio", "PreserveAspectRatio" ),
-        ( "primitiveUnits",     "PrimitiveUnits" ),
-        ( "r",                  "R" ),
-        ( "radius",             "Radius" ),
-        ( "refX",               "RefX" ),
-        ( "refY",               "RefY" ),
-        ( "requiredExtensions", "RequiredExtensions" ),
-        ( "requiredFeatures",   "RequiredFeatures" ),
-        ( "result",             "Result" ),
-        ( "rx",                 "Rx" ),
-        ( "ry",                 "Ry" ),
-        ( "scale",              "Scale" ),
-        ( "seed",               "Seed" ),
-        ( "shape-rendering",    "ShapeRendering" ),
-        ( "slope",              "Slope" ),
-        ( "specularConstant",   "SpecularConstant" ),
-        ( "specularExponent",   "SpecularExponent" ),
-        ( "spreadMethod",       "SpreadMethod" ),
-        ( "stdDeviation",       "StdDeviation" ),
-        ( "stitchTiles",        "StitchTiles" ),
-        ( "stop-color",         "StopColor" ),
-        ( "stop-opacity",       "StopOpacity" ),
-        ( "stroke",             "Stroke" ),
-        ( "stroke-dasharray",   "StrokeDasharray" ),
-        ( "stroke-dashoffset",  "StrokeDashoffset" ),
-        ( "stroke-linecap",     "StrokeLinecap" ),
-        ( "stroke-linejoin",    "StrokeLinejoin" ),
-        ( "stroke-miterlimit",  "StrokeMiterlimit" ),
-        ( "stroke-opacity",     "StrokeOpacity" ),
-        ( "stroke-width",       "StrokeWidth" ),
-        ( "style",              "Style" ),
-        ( "surfaceScale",       "SurfaceScale" ),
-        ( "systemLanguage",     "SystemLanguage" ),
-        ( "tableValues",        "TableValues" ),
-        ( "targetX",            "TargetX" ),
-        ( "targetY",            "TargetY" ),
-        ( "text-anchor",        "TextAnchor" ),
-        ( "text-decoration",    "TextDecoration" ),
-        ( "text-rendering",     "TextRendering" ),
-        ( "transform",          "Transform" ),
-        ( "type",               "Type" ),
-        ( "unicode-bidi",       "UnicodeBidi" ),
-        ( "values",             "Values" ),
-        ( "verts",              "Verts" ),
-        ( "viewBox",            "ViewBox" ),
-        ( "visibility",         "Visibility" ),
-        ( "width",              "Width" ),
-        ( "writing-mode",       "WritingMode" ),
-        ( "x",                  "X" ),
-        ( "x1",                 "X1" ),
-        ( "y1",                 "Y1" ),
-        ( "x2",                 "X2" ),
-        ( "y2",                 "Y2" ),
-        ( "xChannelSelector",   "XChannelSelector" ),
-        ( "xlink:href",         "XlinkHref" ),
-        ( "xml:lang",           "XmlLang" ),
-        ( "xml:space",          "XmlSpace" ),
-        ( "y",                  "Y" ),
-        ( "yChannelSelector",   "YChannelSelector" ),
-        ( "z",                  "Z" ),
-    ];
-
-    let path = Path::new(&env::var("OUT_DIR").unwrap()).join("attributes-codegen.rs");
-    let mut file = BufWriter::new(File::create(&path).unwrap());
-
-    writeln!(&mut file, "#[repr(C)]").unwrap();
-    writeln!(
-        &mut file,
-        "#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]"
-    )
-    .unwrap();
-    writeln!(&mut file, "pub enum Attribute {{").unwrap();
-
-    for &(_, valname) in attribute_defs.iter() {
-        writeln!(&mut file, "    {},", valname).unwrap();
-    }
-
-    writeln!(&mut file, "}}").unwrap();
-
-    writeln!(
-        &mut file,
-        "static ATTRIBUTES: phf::Map<&'static str, Attribute> = "
-    )
-    .unwrap();
-
-    let mut map = phf_codegen::Map::new();
-    map.phf_path("phf");
-    for &(name, valname) in attribute_defs.iter() {
-        let valname = ["Attribute::", valname].concat();
-        map.entry(name, &valname);
-    }
-
-    map.build(&mut file).unwrap();
-    writeln!(&mut file, ";").unwrap();
-}
-
 /// Converts an sRGB color value to a linear sRGB color value (undoes the gamma correction).
 ///
 /// The input and the output are supposed to be in the [0, 1] range.
diff --git a/rsvg_internals/src/lib.rs b/rsvg_internals/src/lib.rs
index 66f3cb36..c18b9bc0 100644
--- a/rsvg_internals/src/lib.rs
+++ b/rsvg_internals/src/lib.rs
@@ -92,7 +92,6 @@ mod property_macros;
 mod allowed_url;
 mod angle;
 mod aspect_ratio;
-mod attributes;
 mod bbox;
 mod c_api;
 mod clip_path;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]