Repository: GuillaumeGomez/sysinfo (language: rust)

Issue:
Enum be able to_string()
Being able to get `String` from Enum would be nice. 

```
let mut sys: System = System::new_all();
let disks = sys.disks();

for disk in disks {
  let disk_kind: String = disk.kind().to_string(); // <--
}
```

My idea is to use the [strum](https://crates.io/crates/strum) library.
```
// src/common.rs

#[derive(Debug, PartialEq, Eq, Clone, Copy, strum_macros::Display)]
pub enum DiskKind {
    /// HDD type.
    HDD,
    /// SSD type.
    SSD,
    /// Unknown type.
    Unknown(isize),
}
```


Discussion / hints:
I didn't implement `Display` for `*kind` enums indeed. I definitely don't want to add a (proc-macro) dependency just for that though.
Saw that coming about that the dependency. Alternatively we could implement a `fmt` function for it.  [answer](https://stackoverflow.com/questions/32710187/how-do-i-get-an-enum-as-a-string)

```
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum DiskKind {
    /// HDD type.
    HDD,
    /// SSD type.
    SSD,
    /// Unknown type.
    Unknown(isize),
}

impl fmt::Display for DiskKind {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{:?}", self)
    }
}

```
Yes it was what I had in mind, sorry, I should have precised. If you're interested, a PR would be very welcome. Otherwise I'll do it in the next days.
I'll do a PR. Thank you 😀 
Well I mean, thank *you*. :laughing: 

Fix patch:
diff --git a/src/common.rs b/src/common.rs
index e65cc54c3..d6710be05 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -2173,6 +2173,16 @@ pub enum DiskKind {
     Unknown(isize),
 }
 
+impl fmt::Display for DiskKind {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.write_str(match *self {
+            DiskKind::HDD => "HDD",
+            DiskKind::SSD => "SSD",
+            _ => "Unknown",
+        })
+    }
+}
+
 /// Interacting with users.
 ///
 /// ```no_run


Test patch: