pub struct StatFs {
pub total_bytes: u64,
pub used_bytes: u64,
pub available_bytes: u64,
pub total_inodes: u64,
pub used_inodes: u64,
pub available_inodes: u64,
pub block_size: u64,
pub max_name_len: u64,
}Expand description
Filesystem-level statistics.
Returned by FsStats::statfs. Contains information
about the filesystem’s capacity, usage, and limits — similar to the POSIX
statvfs system call.
§Fields
| Field | Type | Description |
|---|---|---|
total_bytes | u64 | Total capacity (0 = unlimited) |
used_bytes | u64 | Currently used space |
available_bytes | u64 | Space available for new data |
total_inodes | u64 | Maximum files/directories (0 = unlimited) |
used_inodes | u64 | Currently allocated inodes |
available_inodes | u64 | Inodes available for new entries |
block_size | u64 | Filesystem block size in bytes |
max_name_len | u64 | Maximum filename length |
§Example
use anyfs_backend::StatFs;
let stats = StatFs {
total_bytes: 1_000_000_000, // 1 GB
used_bytes: 250_000_000, // 250 MB used
available_bytes: 750_000_000, // 750 MB free
total_inodes: 100_000,
used_inodes: 1_234,
available_inodes: 98_766,
block_size: 4096,
max_name_len: 255,
};
let usage_percent = (stats.used_bytes as f64 / stats.total_bytes as f64) * 100.0;
println!("Disk usage: {:.1}%", usage_percent); // "Disk usage: 25.0%"§Unlimited Filesystems
For backends without fixed limits (e.g., cloud storage), set capacity fields to 0:
use anyfs_backend::StatFs;
let unlimited = StatFs {
total_bytes: 0, // No limit
total_inodes: 0, // No limit
..Default::default()
};Fields§
§total_bytes: u64Total size in bytes (0 = unlimited).
used_bytes: u64Currently used bytes.
available_bytes: u64Available bytes for use.
total_inodes: u64Total number of inodes (0 = unlimited).
used_inodes: u64Number of used inodes.
available_inodes: u64Number of available inodes.
block_size: u64Block size in bytes.
max_name_len: u64Maximum filename length.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StatFs
impl RefUnwindSafe for StatFs
impl Send for StatFs
impl Sync for StatFs
impl Unpin for StatFs
impl UnwindSafe for StatFs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more