Skip to content

Commit

Permalink
[ucd/unihan] Make unic-ucd-unihan an optional feature
Browse files Browse the repository at this point in the history
The feature is named "unihan" and a user needs to opt-in explicitly to use it
  • Loading branch information
eyeplum committed Mar 5, 2019
1 parent fa97f5c commit a98f5e7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions unic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
6 changes: 5 additions & 1 deletion unic/ucd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -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]
Expand Down
10 changes: 7 additions & 3 deletions unic/ucd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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};

0 comments on commit a98f5e7

Please sign in to comment.