From 871d719a94ceaf1d66e86408129a4bc16be61e95 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 10 Aug 2015 15:19:57 -0700 Subject: [PATCH] Add derive(HeapSizeOf) support. Part of servo/heapsize#5. --- Cargo.toml | 3 +-- src/lib.rs | 2 +- src/parser.rs | 4 ++++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d8abc94..adb556c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,8 +33,7 @@ path = "../string-cache/plugin" optional = true [dependencies.heapsize] -#git = "https://github.com/servo/heapsize" -path = "../heapsize" +git = "https://github.com/servo/heapsize" features = [ "unstable" ] optional = true diff --git a/src/lib.rs b/src/lib.rs index cdfa2df..018e496 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,7 +5,7 @@ #![cfg_attr(feature = "unstable", feature(plugin, hashmap_hasher, custom_derive))] #![cfg_attr(feature = "unstable", plugin(string_cache_plugin))] #![cfg_attr(all(test, feature = "unstable"), feature(test))] -#![cfg_attr(feature = "heap_size", feature(plugin, hashmap_hasher, custom_derive))] +#![cfg_attr(feature = "heap_size", feature(plugin, custom_derive))] #![cfg_attr(feature = "heap_size", plugin(heapsize_plugin))] #[cfg(feature = "heap_size")] extern crate heapsize; diff --git a/src/parser.rs b/src/parser.rs index d10659e..3d85428 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -104,6 +104,7 @@ pub enum SimpleSelector { #[derive(Eq, PartialEq, Clone, Hash, Copy, Debug)] +#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))] pub enum CaseSensitivity { CaseSensitive, // Selectors spec says language-defined, but HTML says sensitive. CaseInsensitive, @@ -111,12 +112,14 @@ pub enum CaseSensitivity { #[derive(Eq, PartialEq, Clone, Hash, Debug)] +#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))] pub struct LocalName { pub name: Atom, pub lower_name: Atom, } #[derive(Eq, PartialEq, Clone, Hash, Debug)] +#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))] pub struct AttrSelector { pub name: Atom, pub lower_name: Atom, @@ -124,6 +127,7 @@ pub struct AttrSelector { } #[derive(Eq, PartialEq, Clone, Hash, Debug)] +#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))] pub enum NamespaceConstraint { Any, Specific(Namespace),