diff --git a/crates/common/src/bootstrap_model/index/database_index/indexed_fields.rs b/crates/common/src/bootstrap_model/index/database_index/indexed_fields.rs index e1e27dd4..6695f906 100644 --- a/crates/common/src/bootstrap_model/index/database_index/indexed_fields.rs +++ b/crates/common/src/bootstrap_model/index/database_index/indexed_fields.rs @@ -35,8 +35,8 @@ use crate::{ pub struct IndexedFields(WithHeapSize>); impl IndexedFields { - pub fn by_id() -> Self { - IndexedFields(vec![].into()) + pub const fn by_id() -> Self { + IndexedFields(WithHeapSize::new_vec()) } pub fn creation_time() -> Self { diff --git a/crates/value/src/heap_size.rs b/crates/value/src/heap_size.rs index 8d8aa68d..f6fef7ef 100644 --- a/crates/value/src/heap_size.rs +++ b/crates/value/src/heap_size.rs @@ -238,6 +238,15 @@ impl From> for WithHeapSize> { } } +impl WithHeapSize> { + pub const fn new_vec() -> Self { + Self { + inner: Vec::new(), + elements_heap_size: 0, + } + } +} + impl From>> for Vec { fn from(value: WithHeapSize>) -> Self { value.inner