From 9d2861955d7eff5c24958d8d0ef9de6f99bbfc4e Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Tue, 3 May 2022 09:22:45 +0900 Subject: [PATCH] Make "unicase + macros" features work --- Cargo.toml | 1 + phf/Cargo.toml | 2 +- phf/examples/unicase-example/Cargo.toml | 10 ++++++++++ phf/examples/unicase-example/src/main.rs | 9 +++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 phf/examples/unicase-example/Cargo.toml create mode 100644 phf/examples/unicase-example/src/main.rs diff --git a/Cargo.toml b/Cargo.toml index 13b416d0..a784d1a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [workspace] members = [ "phf", + "phf/examples/unicase-example", "phf_codegen", "phf_codegen/test", "phf_generator", diff --git a/phf/Cargo.toml b/phf/Cargo.toml index 692dfd72..3e9d1e02 100644 --- a/phf/Cargo.toml +++ b/phf/Cargo.toml @@ -17,7 +17,7 @@ test = false default = ["std"] std = ["phf_shared/std"] uncased = ["phf_shared/uncased"] -unicase = ["phf_shared/unicase"] +unicase = ["phf_macros?/unicase", "phf_shared/unicase"] macros = [ "phf_macros", "proc-macro-hack", diff --git a/phf/examples/unicase-example/Cargo.toml b/phf/examples/unicase-example/Cargo.toml new file mode 100644 index 00000000..b7b2de01 --- /dev/null +++ b/phf/examples/unicase-example/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "unicase-example" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +phf = { version = "0.10", features = ["macros", "unicase"] } +unicase = "2" diff --git a/phf/examples/unicase-example/src/main.rs b/phf/examples/unicase-example/src/main.rs new file mode 100644 index 00000000..34ba613f --- /dev/null +++ b/phf/examples/unicase-example/src/main.rs @@ -0,0 +1,9 @@ +use phf::phf_map; +use unicase::UniCase; + +pub static MAP: phf::Map, isize> = phf_map!( + UniCase::ascii("Foo") => 0, + UniCase::unicode("Bar") => 1, +); + +fn main() {}