mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
stylo: Add hash module for reexporting HashMap
This commit is contained in:
parent
c682943900
commit
fae5e10643
2 changed files with 34 additions and 0 deletions
32
components/style/hash.rs
Normal file
32
components/style/hash.rs
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
/* 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/. */
|
||||||
|
|
||||||
|
//! Reexports of hashglobe types in Gecko mode, and stdlib hashmap shims in Servo mode
|
||||||
|
//!
|
||||||
|
//! Can go away when the stdlib gets fallible collections
|
||||||
|
//! https://github.com/rust-lang/rfcs/pull/2116
|
||||||
|
|
||||||
|
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};
|
||||||
|
|
||||||
|
/// Appropriate reexports of hash_map types
|
||||||
|
pub mod map {
|
||||||
|
#[cfg(feature = "gecko")]
|
||||||
|
pub use hashglobe::hash_map::{Entry, Iter};
|
||||||
|
#[cfg(feature = "servo")]
|
||||||
|
pub use std::collections::hash_map::{Entry, Iter};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Hash map that uses the FNV hasher
|
||||||
|
pub type FnvHashMap<K, V> = HashMap<K, V, fnv::FnvBuildHasher>;
|
||||||
|
/// Hash set that uses the FNV hasher
|
||||||
|
pub type FnvHashSet<T> = HashSet<T, fnv::FnvBuildHasher>;
|
|
@ -49,6 +49,7 @@ extern crate bitflags;
|
||||||
extern crate euclid;
|
extern crate euclid;
|
||||||
extern crate fnv;
|
extern crate fnv;
|
||||||
#[cfg(feature = "gecko")] #[macro_use] pub mod gecko_string_cache;
|
#[cfg(feature = "gecko")] #[macro_use] pub mod gecko_string_cache;
|
||||||
|
extern crate hashglobe;
|
||||||
#[cfg(feature = "servo")] extern crate heapsize;
|
#[cfg(feature = "servo")] extern crate heapsize;
|
||||||
#[cfg(feature = "servo")] #[macro_use] extern crate heapsize_derive;
|
#[cfg(feature = "servo")] #[macro_use] extern crate heapsize_derive;
|
||||||
extern crate itertools;
|
extern crate itertools;
|
||||||
|
@ -112,6 +113,7 @@ pub mod font_face;
|
||||||
pub mod font_metrics;
|
pub mod font_metrics;
|
||||||
#[cfg(feature = "gecko")] #[allow(unsafe_code)] pub mod gecko;
|
#[cfg(feature = "gecko")] #[allow(unsafe_code)] pub mod gecko;
|
||||||
#[cfg(feature = "gecko")] #[allow(unsafe_code)] pub mod gecko_bindings;
|
#[cfg(feature = "gecko")] #[allow(unsafe_code)] pub mod gecko_bindings;
|
||||||
|
pub mod hash;
|
||||||
pub mod invalidation;
|
pub mod invalidation;
|
||||||
#[allow(missing_docs)] // TODO.
|
#[allow(missing_docs)] // TODO.
|
||||||
pub mod logical_geometry;
|
pub mod logical_geometry;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue