GuillaumeGomez / sysinfo

Cross-platform library to fetch system information
MIT License
2.11k stars 316 forks source link

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

Closed dlowe closed 3 weeks ago

dlowe commented 3 weeks 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 3 weeks ago

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

dlowe commented 3 weeks ago

🤦 thank you!

GuillaumeGomez commented 3 weeks ago

😉