GuillaumeGomez / sysinfo

Cross-platform library to fetch system information
MIT License
2.08k stars 311 forks source link

Ability to get an owned `Disk` out of `Disks` #1374

Closed dlowe closed 4 hours ago

dlowe commented 4 hours ago

I'm using sysinfo to report the disk space (total & available) for one disk of interest, over time, in an Fn closure, in a long-lived, multi-threaded process. It's possible, but it's surprisingly convoluted because (AFAICT) there's no way for me to get an owned Disk.

At the moment:

Basically: I want to do the disk-selection on startup, but I can't.

I'd be more than happy to contribute a fix. Would it be welcome? Any guidance on how to approach it? The most obvious thing would be to make Disk be + Clone, but I have no idea if that's possible.

GuillaumeGomez commented 4 hours ago

You can convert your Disks into a Vec<Disk> (see documentation here).

dlowe commented 4 hours ago

🤦 thank you!

GuillaumeGomez commented 4 hours ago

😉