title: How do I use serde to deserialize an optional field from an XML file?
body: <p>I'm trying to deserialize XML file which has element containing nested elements like this:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;element&gt;
    &lt;nested1/&gt;
    &lt;nested2&gt;
    ..
    &lt;nested2&gt;
  &lt;/element&gt;
  </code></pre>
  
  <p>But <code>nested2</code> is not mandatory and is in some cases not present. When this happens, serde throws an error. Is there a way to mark <code>nested2</code> as optional?</p>
  
  <pre><code>#[derive(Deserialize, Debug)]
  struct Element {
      nested1: (),
      #[serde ??]
      nested2: (),
  }
  </code></pre>