I'm in the unfortunate situation where I need to determine the amount of free space available given a directory path. I discovered the sysinfo crate that has Disk::available_space() -- which is perfect .. but how do I get from an arbitrary &Path (pointing to a directory) to a Disk structure?
Do I need to manually perform the path.starts_with(disk.mount_point())/resolve symlinks dance, or is there some helper function that I'm not seeing that'll do all that for me?
I haven't used the crate, just looked at the docs.
I didn't see anything convenient offhand. On Linux/Unix/Apple, you can get the device number of a path from st_dev or dev. Then you need to know the device number of the corresponding mount.