| 1 | pub struct Usagerust-analyzer cargo bottom 0.14.9 collection/disks/unix/usage/Usage#(libcrust-analyzer cargo libc 0.2.189 crate/::statvfsrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/gnu/b64/x86_64/not_x32/statvfs#); |
| 2 | |
| 3 | // Note that x86 returns `u32` values while x86-64 returns `u64`s, so we convert |
| 4 | // everything to `u64` for consistency. |
| 5 | #[allow(clippy::useless_conversion)] |
| 6 | impl Usagerust-analyzer cargo bottom 0.14.9 collection/disks/unix/usage/Usage# { |
| 7 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) fn newrust-analyzer cargo bottom 0.14.9 collection/disks/unix/usage/impl#[Usage]new().(vfs: libcrust-analyzer cargo libc 0.2.189 crate/::statvfsrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/gnu/b64/x86_64/not_x32/statvfs#) -> Selfrust-analyzer cargo bottom 0.14.9 collection/disks/unix/usage/impl#[Usage] { |
| 8 | Selfrust-analyzer cargo bottom 0.14.9 collection/disks/unix/usage/impl#[Usage](vfs) |
| 9 | } |
| 10 | |
| 11 | /// Returns the total number of bytes available. |
| 12 | pub fn totalrust-analyzer cargo bottom 0.14.9 collection/disks/unix/usage/impl#[Usage]total().(&self) -> u64 { |
| 13 | u64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`From<Self>`]from().(self.0rust-analyzer cargo bottom 0.14.9 collection/disks/unix/usage/Usage#0..f_blocksrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/gnu/b64/x86_64/not_x32/statvfs#f_blocks.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Mul<Self>`]mul().u64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`From<Self>`]from().(self.0rust-analyzer cargo bottom 0.14.9 collection/disks/unix/usage/Usage#0..f_frsizerust-analyzer cargo libc 0.2.189 unix/linux_like/linux/gnu/b64/x86_64/not_x32/statvfs#f_frsize.) |
| 14 | } |
| 15 | |
| 16 | /// Returns the available number of bytes used. Note this is not necessarily |
| 17 | /// the same as [`Usage::free`]. |
| 18 | pub fn availablerust-analyzer cargo bottom 0.14.9 collection/disks/unix/usage/impl#[Usage]available().(&self) -> u64 { |
| 19 | u64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`From<Self>`]from().(self.0rust-analyzer cargo bottom 0.14.9 collection/disks/unix/usage/Usage#0..f_bfreerust-analyzer cargo libc 0.2.189 unix/linux_like/linux/gnu/b64/x86_64/not_x32/statvfs#f_bfree.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Mul<Self>`]mul().u64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`From<Self>`]from().(self.0rust-analyzer cargo bottom 0.14.9 collection/disks/unix/usage/Usage#0..f_frsizerust-analyzer cargo libc 0.2.189 unix/linux_like/linux/gnu/b64/x86_64/not_x32/statvfs#f_frsize.) |
| 20 | } |
| 21 | |
| 22 | #[expect(dead_code)] |
| 23 | /// Returns the total number of bytes used. Equal to `total - available` on |
| 24 | /// Unix. |
| 25 | pub fn usedrust-analyzer cargo bottom 0.14.9 collection/disks/unix/usage/impl#[Usage]used().(&self) -> u64 { |
| 26 | let avail_to_root = u64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`From<Self>`]from().(self.0rust-analyzer cargo bottom 0.14.9 collection/disks/unix/usage/Usage#0..f_bfreerust-analyzer cargo libc 0.2.189 unix/linux_like/linux/gnu/b64/x86_64/not_x32/statvfs#f_bfree.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Mul<Self>`]mul().u64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`From<Self>`]from().(self.0rust-analyzer cargo bottom 0.14.9 collection/disks/unix/usage/Usage#0..f_frsizerust-analyzer cargo libc 0.2.189 unix/linux_like/linux/gnu/b64/x86_64/not_x32/statvfs#f_frsize.); |
| 27 | self.totalrust-analyzer cargo bottom 0.14.9 collection/disks/unix/usage/impl#[Usage]total().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Sub<Self>`]sub().avail_to_root |
| 28 | } |
| 29 | |
| 30 | /// Returns the total number of bytes free. Note this is not necessarily the |
| 31 | /// same as [`Usage::available`]. |
| 32 | pub fn freerust-analyzer cargo bottom 0.14.9 collection/disks/unix/usage/impl#[Usage]free().(&self) -> u64 { |
| 33 | u64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`From<Self>`]from().(self.0rust-analyzer cargo bottom 0.14.9 collection/disks/unix/usage/Usage#0..f_bavailrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/gnu/b64/x86_64/not_x32/statvfs#f_bavail.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Mul<Self>`]mul().u64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`From<Self>`]from().(self.0rust-analyzer cargo bottom 0.14.9 collection/disks/unix/usage/Usage#0..f_frsizerust-analyzer cargo libc 0.2.189 unix/linux_like/linux/gnu/b64/x86_64/not_x32/statvfs#f_frsize.) |
| 34 | } |
| 35 | } |