Simplify MemoryStats fetching

This commit is contained in:
Clément Renault 2024-02-07 10:09:39 +01:00 committed by Louis Dureuil
parent 4de2db6786
commit f3c34d5b8c
No known key found for this signature in database
2 changed files with 6 additions and 7 deletions

View file

@ -121,6 +121,11 @@ impl MemoryStats {
}
}
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
pub fn fetch() -> Option<Self> {
None
}
pub fn checked_sub(self, other: Self) -> Option<Self> {
Some(Self { resident: self.resident.checked_sub(other.resident)? })
}