rust-phf icon indicating copy to clipboard operation
rust-phf copied to clipboard

Support for tuples

Open SorteKanin opened this issue 5 years ago • 1 comments

I would like to be able to make a set of tuples, like so:

use phf::phf_set;
static MY_SET: phf::Set<(&str, u32, &[&str])> = phf_set! {
    ("some value", 1, &["even", "more", "values"]),
};

This is currently not possible it seems. I am guessing it's also not possible to use tuples as keys in phf::Map

You can work around this by using phf_map with the first value as key and the rest as the resulting value but that isn't very ergonomic and also only works if the first value is unique.

SorteKanin avatar Nov 22 '20 15:11 SorteKanin

As with #183 it would be good for this limitation to be clearly documented.

stephanemagnenat avatar Mar 24 '21 18:03 stephanemagnenat