Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HeapSizeOf support. #85

Merged
merged 4 commits into from
Aug 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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