Skip to content

Commit

Permalink
Auto merge of #105 - notriddle:master, r=SimonSapin
Browse files Browse the repository at this point in the history
derive(HeapSizeOf).

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/string-cache/105)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Aug 13, 2015
2 parents 18ac6e1 + 730382c commit bad515a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 0 deletions.
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 test
- cargo test --features log-events
- "if [ $TRAVIS_RUST_VERSION = nightly ]; then cargo test --features unstable; fi"
- "if [ $TRAVIS_RUST_VERSION = nightly ]; then cargo test --features heap_size; fi"
- "cd examples/summarize-events/ && cargo build"
notifications:
webhooks: http://build.servo.org:54856/travis
11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ log-events = ["rustc-serialize"]
# Use unstable features to optimize space and time (memory and CPU usage).
unstable = ["string_cache_plugin"]

# HeapSizeOf support
heap_size = ["heapsize", "heapsize_plugin"]

[dependencies]
lazy_static = "0.1.10"
serde = "0.5"
Expand All @@ -44,6 +47,14 @@ optional = true
path = "shared"
version = "0.1.4"

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

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

[build-dependencies.string_cache_shared]
path = "shared"
version = "0.1.4"
1 change: 1 addition & 0 deletions src/atom/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ impl StringCache {
// NOTE: Deriving Eq here implies that a given string must always
// be interned the same way.
#[cfg_attr(feature = "unstable", unsafe_no_drop_flag)] // See tests::atom_drop_is_idempotent
#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
#[derive(Eq, Hash, PartialEq)]
pub struct Atom {
/// This field is public so that the `atom!()` macro can use it.
Expand Down
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
#![cfg_attr(test, deny(warnings))]
#![cfg_attr(all(test, feature = "unstable"), feature(test, filling_drop))]
#![cfg_attr(feature = "unstable", feature(unsafe_no_drop_flag, plugin))]
#![cfg_attr(feature = "heap_size", feature(plugin, custom_derive))]
#![cfg_attr(feature = "unstable", plugin(string_cache_plugin))]
#![cfg_attr(feature = "heap_size", plugin(heapsize_plugin))]

#[cfg(all(test, feature = "unstable"))]
extern crate test;
Expand All @@ -27,6 +29,9 @@ extern crate rand;
#[cfg(feature = "log-events")]
extern crate rustc_serialize;

#[cfg(feature = "heap_size")]
extern crate heapsize;

extern crate serde;

extern crate string_cache_shared;
Expand Down
1 change: 1 addition & 0 deletions src/namespace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use atom::Atom;
/// Whether a given string represents a namespace is contextual, so this is
/// a transparent wrapper that will not catch all mistakes.
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone)]
#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
pub struct Namespace(pub Atom);

/// A name with a namespace.
Expand Down

0 comments on commit bad515a

Please sign in to comment.