aboutsummaryrefslogtreecommitdiff
path: root/build.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-11-19 08:38:57 +0100
committerMartin Fischer <martin@push-f.com>2021-11-19 08:38:58 +0100
commit98ad8cec144900c7799772b3a53241825b416b4f (patch)
tree8a18df3e9ff4c4be5316112c0f02db72f9ef94f2 /build.rs
parent7207abccd9dccb15eb37f43a8f763cac99be14d4 (diff)
feature gate named-entities (making phf optional)
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/build.rs b/build.rs
index 8d4404c..d41934c 100644
--- a/build.rs
+++ b/build.rs
@@ -7,20 +7,21 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+#[cfg(feature = "named-entities")]
extern crate phf_codegen;
-use std::collections::HashMap;
-use std::env;
-use std::fs::File;
-use std::io::Write;
-use std::path::Path;
+#[cfg(feature = "named-entities")]
+use {std::collections::HashMap, std::env, std::fs::File, std::io::Write, std::path::Path};
+#[cfg(feature = "named-entities")]
mod entities;
fn main() {
+ #[cfg(feature = "named-entities")]
named_entities_to_phf(&Path::new(&env::var("OUT_DIR").unwrap()).join("named_entities.rs"));
}
+#[cfg(feature = "named-entities")]
fn named_entities_to_phf(to: &Path) {
let mut entities: HashMap<&str, (u32, u32)> = entities::NAMED_ENTITIES
.iter()