Bug 1393656 - Part 2: stylo: Add hash module for reexporting HashMap; r?emilio draft
authorManish Goregaokar <manishearth@gmail.com>
Wed, 30 Aug 2017 17:00:15 -0700
changeset 656306 90c17784a4f15053e5480c1eb6468b73198ba65e
parent 656303 77d7413cc39defb696b8a896a86965a2c23c5091
child 656307 354662f34a43cbb7d2d55d631632ea833b583dc6
child 656310 63522c067a6ca2783e67a95cafa04077e73c4155
push id77160
push userbmo:manishearth@gmail.com
push dateThu, 31 Aug 2017 00:19:57 +0000
reviewersemilio
bugs1393656
milestone57.0a1
Bug 1393656 - Part 2: stylo: Add hash module for reexporting HashMap; r?emilio MozReview-Commit-ID: 8gq04LlzDZI
servo/components/style/hash.rs
servo/components/style/lib.rs
new file mode 100644
--- /dev/null
+++ b/servo/components/style/hash.rs
@@ -0,0 +1,18 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use fnv;
+
+#[cfg(feature = "gecko")]
+pub use hashglobe::hash_map::HashMap;
+#[cfg(feature = "gecko")]
+pub use hashglobe::hash_set::HashSet;
+
+
+#[cfg(feature = "servo")]
+pub use hashglobe::fake::{HashMap, HashSet};
+
+
+pub type FnvHashMap<K, V> = HashMap<K, V, fnv::FnvBuildHasher>;
+pub type FnvHashSet<T> = HashSet<T, fnv::FnvBuildHasher>;
--- a/servo/components/style/lib.rs
+++ b/servo/components/style/lib.rs
@@ -44,16 +44,17 @@ extern crate bit_vec;
 #[macro_use]
 extern crate bitflags;
 #[allow(unused_extern_crates)] extern crate byteorder;
 #[cfg(feature = "gecko")] #[macro_use] #[no_link] extern crate cfg_if;
 #[macro_use] extern crate cssparser;
 extern crate euclid;
 extern crate fnv;
 #[cfg(feature = "gecko")] #[macro_use] pub mod gecko_string_cache;
+extern crate hashglobe;
 #[cfg(feature = "servo")] extern crate heapsize;
 #[cfg(feature = "servo")] #[macro_use] extern crate heapsize_derive;
 extern crate itertools;
 extern crate itoa;
 #[cfg(feature = "servo")] #[macro_use] extern crate html5ever;
 #[macro_use]
 extern crate lazy_static;
 #[macro_use]
@@ -108,16 +109,17 @@ pub mod dom;
 pub mod driver;
 pub mod element_state;
 #[cfg(feature = "servo")] mod encoding_support;
 pub mod error_reporting;
 pub mod font_face;
 pub mod font_metrics;
 #[cfg(feature = "gecko")] #[allow(unsafe_code)] pub mod gecko;
 #[cfg(feature = "gecko")] #[allow(unsafe_code)] pub mod gecko_bindings;
+pub mod hash;
 pub mod invalidation;
 #[allow(missing_docs)] // TODO.
 pub mod logical_geometry;
 pub mod matching;
 pub mod media_queries;
 pub mod parallel;
 pub mod parser;
 pub mod rule_tree;