Skip to content

Commit

Permalink
Apply SparseSetMemoryUsage prettier debug format
Browse files Browse the repository at this point in the history
  • Loading branch information
notinmybackyaard committed Feb 26, 2025
1 parent 0c69e7d commit 5d607cc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/memory_usage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pub struct WorldMemoryUsage<'w>(pub(crate) &'w World);

pub struct AllStoragesMemoryUsage<'a>(pub(crate) &'a AllStorages);

#[derive(Debug)]
pub struct SparseSetMemoryUsage {
pub spase: usize,
pub dense: usize,
Expand All @@ -18,6 +17,15 @@ pub struct SparseSetMemoryUsage {
pub self_data: usize,
}

impl core::fmt::Debug for SparseSetMemoryUsage {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.write_fmt(format_args!(
"(spase: {}, dense: {}, data: {}, insertion_data: {}, modification_data: {}, deletion_data: {}, removal_data: {}, self_data: {})",
self.spase, self.dense, self.data, self.insertion_data, self.modification_data, self.deletion_data, self.removal_data, self.self_data
))
}
}

impl SparseSetMemoryUsage {
pub fn sum(&self) -> usize {
self.spase
Expand Down

0 comments on commit 5d607cc

Please sign in to comment.