Hello. I'm trying to convert this simple TypeScript code to Rust:
const FRUITS = new Set(["apple", "banana"]);
function isFruit(thing: string): boolean {
return mySet.has(thing);
}
I tried asking ChatGPT, but it gave me a solution that was either using unsafe (which is bad) or using lazy_static (which is an extra dependency).
Is there not a simple way to do this code in Rust with just the standard library?