Skip to content

Commit 6fdef9f

Browse files
authored
Implement MallocSizeOf for Au (#61)
Signed-off-by: Nico Burns <nico@nicoburns.com>
1 parent 480397f commit 6fdef9f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "app_units"
3-
version = "0.7.6"
3+
version = "0.7.7"
44
authors = ["The Servo Project Developers"]
55
description = "Servo app units type (Au)"
66
documentation = "https://docs.rs/app_units/"
@@ -11,6 +11,7 @@ edition = "2021"
1111
[dependencies]
1212
num-traits = { version = "0.2", optional = true }
1313
serde = { version = "1.0", optional = true, features = ["derive"] }
14+
malloc_size_of = { version = "0.1", default-features = false, optional = true }
1415

1516
[dev-dependencies]
1617
ron = "0.8.0"
@@ -19,3 +20,4 @@ ron = "0.8.0"
1920
default = ["num_traits", "serde_serialization"]
2021
num_traits = ["num-traits"]
2122
serde_serialization = ["serde"]
23+
malloc_size_of = ["dep:malloc_size_of"]

src/app_unit.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5+
#[cfg(feature = "malloc_size_of")]
6+
use malloc_size_of::malloc_size_of_is_0;
57
#[cfg(feature = "num_traits")]
68
use num_traits::Zero;
79
#[cfg(feature = "serde_serialization")]
@@ -40,6 +42,9 @@ impl fmt::Debug for Au {
4042
}
4143
}
4244

45+
#[cfg(feature = "malloc_size_of")]
46+
malloc_size_of_is_0!(Au);
47+
4348
#[cfg(feature = "serde_serialization")]
4449
impl<'de> Deserialize<'de> for Au {
4550
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Au, D::Error> {

0 commit comments

Comments
 (0)