title: Get name of enum variant as string with serde
body: <p>I'm trying to get the name of an enum variant as the string serde would expect/create. For example, say I have the following enum:</p>
  <pre><code>#[derive(Serialize, Deserialize)]
  #[serde(rename_all=&quot;camelCase&quot;)]
  pub enum SomeEnum {
      WithoutValue,
      withValue(i32),
  }
  </code></pre>
  <p>How can I then get the serde names of the variants? Something like</p>
  <pre><code>serde::key_name(SomeEnum::WithoutValue) // should be `withoutValue`
  serde::key_name(SomeEnum::WithValue)    // should be `withValue`
  </code></pre>
  <p>I can use a hack with <code>serde_json</code>, for variants without a value I can do:</p>
  <pre><code>serde_json::to_string(SomeEnum::WithoutValue).unwrap(); // yields `&quot;withoutValue&quot;` with quotation marks
  </code></pre>
  <p>This is not the best solution as I then need to strip the quotation marks, but can technically work.</p>
  <p>Even worse is when the enum variant has a value. It becomes much messier.</p>
  <pre><code>serde_json::to_string(SomeEnum::WithValue(0)).unwrap(); // yields `&quot;{\&quot;second\&quot;:0}&quot;
  </code></pre>
  <p>Is there a clean way to achieve this? I can't find a serde API to get key name as a string.</p>