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:
on startup, call Disks::new_with_refreshed_list() (In a mutex, in a lazy_static)
each time my closure is called to recompute totals:
acquire the mutex lock
iterate over Disks::list_mut() to find the one I'm interested in (always the same disk!)
call Disk::refresh() on the selected Disk
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.
I'm using
sysinfo
to report the disk space (total & available) for one disk of interest, over time, in anFn
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 ownedDisk
.At the moment:
Disks::new_with_refreshed_list()
(In a mutex, in alazy_static
)Disks::list_mut()
to find the one I'm interested in (always the same disk!)Disk::refresh()
on the selectedDisk
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.