Compile time evaluation in Nim, Zig, Rust and C++
One possible solution in Rust could be:<p><pre><code>    enum Value {
        Fizz,
        Buzz,
        FizzBuzz,
        Number(usize),
    }

    impl std::fmt::Display for Value {
        fn fmt(&amp;self, f: &amp;mut std::fmt::Formatter) -&gt; std::fmt::Result {
            match self {
                Value::Fizz =&gt; write!(f, &quot;Fizz&quot;),
                Value::Buzz =&gt; write!(f, &quot;Buzz&quot;),
                Value::FizzBuzz =&gt; write!(f, &quot;FizzBuzz&quot;),
                Value::Number(num) =&gt; write!(f, &quot;{}&quot;, num),
            }
        }
    }

    const fn get_fizzbuzz_equivalent(number: usize) -&gt; Value {
        if number % 15 == 0 {
            Value::FizzBuzz
        } else if number % 3 == 0 {
            Value::Fizz
        } else if number % 5 == 0 {
            Value::Buzz
        } else {
            Value::Number(number)
        }
    }

    fn main() {
        (1..100).for_each(|num| println!(&quot;{}&quot;, get_fizzbuzz_equivalent(num)));
    }</code></pre>