Skip to main content

space

Function space 

Source
pub fn space(path: impl AsRef<Path>) -> Result<Space>
Expand description

The space on the filesystem holding path: one system call, no allocation.

This blocks if path is on a dead network mount: pointing it there is the caller’s choice.

use sys_lib as sys;

let s = sys::disk::space(".")?;
if s.available < sys::Bytes::from_gib(10) { /* refuse compaction */ }

§Errors

NotFound when path does not exist; PermissionDenied; Os when the call fails.