Mastodon Feed: Post

Mastodon Feed

rust@octodon.social ("Rust tips") wrote:

Match against many strings (`match s { "string1" | "string2" | "string100" | "etc" }`) unfortunately compiles to naive linear code, not any smarter than series of `if/else`.

If you need to match text against lots of strings, try https://lib.rs/phf or https://crates.io/crates/fst.

#rustlang