pub trait MemoryPressure: Send + Sync + 'static {
fn effective_target_bytes(&self) -> u64;
fn resident_bytes(&self) -> u64;
}
#[derive(Debug, Clone, Copy)]
pub struct StaticPressure {
effective_target_bytes: u64,
resident_bytes: u64,
}
impl StaticPressure {
#[must_use]
pub fn new(effective_target_bytes: u64, resident_bytes: u64) -> Self {
Self {
effective_target_bytes,
resident_bytes,
}
}
}
impl MemoryPressure for StaticPressure {
fn effective_target_bytes(&self) -> u64 {
self.effective_target_bytes
}
fn resident_bytes(&self) -> u64 {
self.resident_bytes
}
}