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

derive(HeapSizeOf). #105

Merged
merged 2 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 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