Using Rust's enum as a bi-directional lookup table
<p>I am writing code that interacts with the <a href="https://developer.gnome.org/NetworkManager/stable/gdbus-org.freedesktop.NetworkManager.html" rel="nofollow noreferrer">NetworkManager</a> over D-Bus and I want to use an <code>enum</code> using as key-value like scheme. </p>

<p>For example, I want once to use the value <code>0</code> as the digit zero and in different context to use the string <code>Unknown</code> of this <code>enum</code>:</p>

<pre><code>pub enum NetworkManagerState {
    Unknown = 0,
    Asleep = 10,
    Disconnected = 20,
    Disconnecting = 30,
    Connecting = 40,
    ConnectedLocal = 50,
    ConnectedSite = 60,
    ConnectedGlobal = 70,
}
</code></pre>

<p>What is the cleanest, most idiomatic way of doing so? Is there a way to define a tuple based enum that each entry looks like that <code>(ConnectedSite, 60u32, "Connected")</code> and use each tuple attribute upon context. </p>