Skip to content

Commit b3a4615

Browse files
committed
Merge pull request #2 from nox/heapsize
Support heapsize
2 parents 87087b5 + b8df925 commit b3a4615

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,14 @@ license = "MIT"
99
repository = "https://github.com/pyfisch/rust-language-tags"
1010
documentation = "http://pyfisch.github.io/rust-language-tags/language_tags/"
1111
keywords = ["language", "internationalization", "translation", "http", "html"]
12+
13+
[dependencies.heapsize]
14+
version = "0.2.2"
15+
optional = true
16+
17+
[dependencies.heapsize_plugin]
18+
version = "0.1.2"
19+
optional = true
20+
21+
[features]
22+
heap_size = ["heapsize", "heapsize_plugin"]

src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#![deny(missing_docs)]
22
#![cfg_attr(test, deny(warnings))]
3+
#![cfg_attr(feature = "heap_size", feature(custom_derive, plugin))]
4+
#![cfg_attr(feature = "heap_size", plugin(heapsize_plugin))]
35

46
//! Language tags can be used identify human languages, scripts e.g. Latin script, countries and
57
//! other regions.
@@ -47,6 +49,9 @@
4749
//!
4850
//! There is also the `langtag!` macro for creating language tags.
4951
52+
#[cfg(feature = "heap_size")]
53+
extern crate heapsize;
54+
5055
use std::ascii::AsciiExt;
5156
use std::cmp::Ordering;
5257
use std::collections::{BTreeMap, BTreeSet};
@@ -212,6 +217,7 @@ const DEPRECATED_REGION: [(&'static str, &'static str); 6] = [("BU", "MM"),
212217
/// but excludes languages not intended primarily for human
213218
/// communication, such as programming languages.
214219
#[derive(Debug, Default, Eq, Clone)]
220+
#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
215221
pub struct LanguageTag {
216222
/// Language subtags are used to indicate the language, ignoring all
217223
/// other aspects such as script, region or spefic invariants.

0 commit comments

Comments
 (0)