Join Nostr
2024-08-20 19:27:19 UTC

fasterthanlime 🌌 on Nostr: A lesson I keep relearning in Rust is: if you have a finite number of values, you ...

A lesson I keep relearning in Rust is: if you have a finite number of values, you don't have to use a String, &str, Cow<'a, str>, smartstring type or whatever, or a structured parsed version thereof... you can just an enum

I only have maybe 15 mime types to deal with — now they're an enum, bam, they're Clone and Copy. Bye allocations!