From a98f5e7e258a30779aad4d37473c167257b2ac7b Mon Sep 17 00:00:00 2001 From: Yan Li Date: Mon, 4 Mar 2019 22:02:51 +1300 Subject: [PATCH] [ucd/unihan] Make unic-ucd-unihan an optional feature The feature is named "unihan" and a user needs to opt-in explicitly to use it --- unic/Cargo.toml | 1 + unic/ucd/Cargo.toml | 6 +++++- unic/ucd/src/lib.rs | 10 +++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/unic/Cargo.toml b/unic/Cargo.toml index 05646162..080d203c 100644 --- a/unic/Cargo.toml +++ b/unic/Cargo.toml @@ -18,6 +18,7 @@ default = [] unstable = ["unic-common/unstable"] # Rust nightly features bench_it = ["unic-bidi/bench_it"] serde = ["unic-bidi/serde"] +unihan = ["unic-ucd/unihan"] [dependencies] unic-bidi = { path = "bidi/", version = "0.9.0" } diff --git a/unic/ucd/Cargo.toml b/unic/ucd/Cargo.toml index 5dc0e197..9b834a5b 100644 --- a/unic/ucd/Cargo.toml +++ b/unic/ucd/Cargo.toml @@ -13,6 +13,10 @@ readme = "README.md" # No tests/benches that depends on /data/ exclude = [] +[features] +default = [] +unihan = ["unic-ucd-unihan"] + [dependencies] unic-ucd-age = { path = "age/", version = "0.9.0" } unic-ucd-bidi = { path = "bidi/", version = "0.9.0" } @@ -26,7 +30,7 @@ unic-ucd-name = { path = "name/", version = "0.9.0" } unic-ucd-name_aliases = { path = "name_aliases/", version = "0.9.0" } unic-ucd-normal = { path = "normal/", version = "0.9.0", features = ["unic-ucd-category"] } unic-ucd-segment = { path = "segment/", version = "0.9.0" } -unic-ucd-unihan = { path = "unihan/", version = "0.9.0" } +unic-ucd-unihan = { path = "unihan/", version = "0.9.0", optional = true } unic-ucd-version = { path = "version/", version = "0.9.0" } [dev-dependencies] diff --git a/unic/ucd/src/lib.rs b/unic/ucd/src/lib.rs index beca8a20..659b31fc 100644 --- a/unic/ucd/src/lib.rs +++ b/unic/ucd/src/lib.rs @@ -38,7 +38,6 @@ pub use unic_ucd_name as name; pub use unic_ucd_name_aliases as name_aliases; pub use unic_ucd_normal as normal; pub use unic_ucd_segment as segment; -pub use unic_ucd_unihan as unihan; pub use crate::version::UnicodeVersion; @@ -84,7 +83,12 @@ pub use crate::name_aliases::{name_aliases_of, NameAliasType}; pub use crate::segment::{GraphemeClusterBreak, SentenceBreak, WordBreak}; -pub use crate::unihan::{definition_of, mandarin_of, simplified_variant_of, traditional_variant_of}; - mod pkg_info; pub use crate::pkg_info::{PKG_DESCRIPTION, PKG_NAME, PKG_VERSION}; + +#[cfg(feature = "unihan")] +pub use unic_ucd_unihan as unihan; + +#[cfg(feature = "unihan")] +pub use crate::unihan::{definition_of, mandarin_of, simplified_variant_of, traditional_variant_of}; +