size_of/support/
bigdecimal.rs1#![cfg(feature = "bigdecimal")]
2
3use crate::{Context, SizeOf};
4use bigdecimal::BigDecimal;
5use core::mem::size_of;
6
7#[cfg(any(target_pointer_width = "64", target_pointer_width = "128"))]
8type BigDigit = u64;
9#[cfg(not(any(target_pointer_width = "64", target_pointer_width = "128")))]
10type BigDigit = u32;
11
12impl SizeOf for BigDecimal {
13 fn size_of_children(&self, context: &mut Context) {
14 context
16 .add_arraylike(self.digits() as usize, size_of::<BigDigit>())
17 .add_distinct_allocation();
18 }
19}