Skip to content

Commit

Permalink
Auto merge of #85 - notriddle:master, r=SimonSapin
Browse files Browse the repository at this point in the history
Add HeapSizeOf support.

Part of servo/heapsize#5.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/rust-cssparser/85)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Aug 13, 2015
2 parents f0f3e53 + 9e84a9f commit 440a30f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ script:
- cargo build --verbose
- cargo test --verbose
- cargo doc --verbose
- ([ $TRAVIS_RUST_VERSION != nightly ] || cargo test --features heap_size)

after_success: |
[ $TRAVIS_RUST_VERSION = nightly ] &&
Expand Down
10 changes: 9 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,18 @@ optional = true
[dependencies.serde_macros]
optional = true

[dependencies.heapsize]
version = "0.1.1"
optional = true

[dependencies.heapsize_plugin]
version = "0.0.1"
optional = true

[dependencies]
encoding = "0.2"
matches = "0.1"

[features]
serde-serialization = [ "serde", "serde_macros" ]

heap_size = [ "heapsize", "heapsize_plugin" ]
2 changes: 2 additions & 0 deletions src/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use super::{Token, Parser, ToCss};
/// A color with red, green, blue, and alpha components.
#[derive(Clone, Copy, PartialEq, Debug)]
#[cfg_attr(feature = "serde-serialization", derive(Deserialize, Serialize))]
#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
pub struct RGBA {
/// The red channel. Nominally in 0.0 ... 1.0.
pub red: f32,
Expand Down Expand Up @@ -41,6 +42,7 @@ impl ToCss for RGBA {

/// A <color> value.
#[derive(Clone, Copy, PartialEq, Debug)]
#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
pub enum Color {
/// The 'currentColor' keyword
CurrentColor,
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
#![cfg_attr(feature = "serde-serialization", feature(custom_derive))]
#![cfg_attr(feature = "serde-serialization", feature(plugin))]
#![cfg_attr(feature = "serde-serialization", plugin(serde_macros))]
#![cfg_attr(feature = "heap_size", feature(custom_derive))]
#![cfg_attr(feature = "heap_size", feature(plugin))]
#![cfg_attr(feature = "heap_size", plugin(heapsize_plugin))]

/*!
Expand Down Expand Up @@ -71,6 +74,7 @@ extern crate encoding;
#[cfg(test)] extern crate tempdir;
#[cfg(test)] extern crate rustc_serialize;
#[cfg(feature = "serde-serialization")] extern crate serde;
#[cfg(feature = "heap_size")] extern crate heapsize;

pub use tokenizer::{Token, NumericValue, PercentageValue, SourceLocation};
pub use rules_and_declarations::{parse_important};
Expand Down

0 comments on commit 440a30f

Please sign in to comment.