Use existing types in an enum in Rust
<p>Say I have two structs:</p>

<pre><code>struct BlankDoc {
    width: u32,
    height: u32
}

struct UrlDoc&lt;'a&gt; {
    url: &amp;str&lt;'a&gt;
}
</code></pre>

<p>Is there some way to use enums to make a <code>Doc</code> type that will be either a <code>BlankDoc</code> or a <code>UrlDoc</code>, without having to reimplement (copy) all of their fields?</p>

<p>I was thinking something like this:</p>

<pre><code>enum Doc {
    &amp;BlankDoc
    &amp;UrlDoc
}
</code></pre>

<p>or</p>

<pre><code>type Doc = BlankDoc|UrlDoc;
</code></pre>

<p>(Obviously neither of these ways exist.)</p>

<p>What's the idiomatic way to model this in Rust?</p>