use crate::strings::StringsMemory;
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct StoreMemory {
pub fixed_bytes: usize,
pub slab_bytes: usize,
pub boxed_payload_bytes: usize,
pub current_table_bytes: usize,
pub retired_table_bytes: usize,
pub retired_tables: usize,
pub retirement_tracking_bytes: usize,
pub rehash_scratch_bytes: usize,
pub largest_rehash_scratch_bytes: usize,
pub strings: StringsMemory,
pub has_printer: bool,
pub has_draws: bool,
pub has_registers: bool,
}
impl StoreMemory {
#[must_use]
pub fn known_retained_bytes(self) -> Option<usize> {
[
self.fixed_bytes,
self.slab_bytes,
self.boxed_payload_bytes,
self.current_table_bytes,
self.retired_table_bytes,
self.retirement_tracking_bytes,
self.strings.known_retained_bytes()?,
]
.into_iter()
.try_fold(0usize, usize::checked_add)
}
}