title: Returning value of enum
body: <p>I'm implementing FizzBuzz in Rust. I went from the simplest version to using an enum and I can't resolve it. I've read enums are very potent so I tried to use them to their fullest.</p>
  
  <p>Here is my implementation:</p>
  
  <pre><code>use std::fmt;
  
  fn main() {
      for i in 1..100 {
          println!("{}", fizzbuzz(i))
      }
  }
  
  fn fizzbuzz(value: i32) -&gt; Answer {
      use crate::Answer::*;
      return match (value % 3, value % 5) {
          (0, 0) =&gt; FizzBuzz,
          (0, _) =&gt; Fizz,
          (_, 0) =&gt; Buzz,
          (_, _) =&gt; Nothing(value),
      };
  }
  
  enum Answer {
      FizzBuzz,
      Fizz,
      Buzz,
      Nothing(i32),
  }
  
  impl fmt::Display for Answer {
      fn fmt(&amp;self, f: &amp;mut fmt::Formatter) -&gt; fmt::Result {
          use crate::Answer::*;
          match self {
              FizzBuzz =&gt; write!(f, "FizzBuzz"),
              Fizz =&gt; write!(f, "Fizz"),
              Buzz =&gt; write!(f, "Buzz"),
              Nothing() =&gt; write!(f, "number passed to NoBuzz"),
          }
      }
  }
  </code></pre>
  
  <p>I have 2 problems:</p>
  
  <ul>
  <li><p>how to use the name of actual enum in <code>match self</code> block?
  In Java, I could use just <code>FizzBuzz.name()</code> and it would print
  <code>"FizzBuzz"</code> - is it possible in Rust?</p></li>
  <li><p>is it possible to print that <code>value</code> I passed to <code>Nothing</code> in <code>fizzbuzz</code> 
  function?</p></li>
  </ul>