diff --git a/crates/re_types_core/src/size_bytes.rs b/crates/re_types_core/src/size_bytes.rs index 1aa471dcc4549..71c94385dd6ad 100644 --- a/crates/re_types_core/src/size_bytes.rs +++ b/crates/re_types_core/src/size_bytes.rs @@ -182,6 +182,13 @@ impl SizeBytes for Arc { } } +impl SizeBytes for Box { + #[inline] + fn heap_size_bytes(&self) -> u64 { + T::total_size_bytes(&**self) + } +} + // TODO(rust-lang/rust#31844): `impl SizeBytesExt for T {}` would be nice but // violates orphan rules. macro_rules! impl_size_bytes_pod { @@ -327,11 +334,19 @@ impl SizeBytes for Field { } impl SizeBytes for dyn Array { + #[inline] fn heap_size_bytes(&self) -> u64 { estimated_bytes_size(self) as _ } } +impl SizeBytes for Box { + #[inline] + fn heap_size_bytes(&self) -> u64 { + estimated_bytes_size(&**self as _) as _ + } +} + // --- Arrow estimations --- // The following is a modified version of [1], available under MIT OR Apache-2.0.