Why Nostr? What is Njump?
2024-08-20 19:27:19

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!
Author Public Key
npub15vn9wvp7aqleey6dqkx2xk5q866lgxvndzgjewa988rlpq8uhruqdkm4th