Skip to main content

Module decimal_obj

Module decimal_obj 

Source
Expand description

Refcounted, repr(C) Decimal carrier for v2 runtime.

§Memory layout (24 bytes)

Offset  Size  Field
------  ----  -----
  0       8   header (HeapHeader — refcount at offset 0)
  8      16   value (rust_decimal::Decimal — inline payload)

Mirrors the StringObj precedent — #[repr(C)] 24-byte struct with HeapHeader at offset 0. rust_decimal::Decimal is Copy + 16-byte (4-byte flags + 12-byte mantissa per the crate’s internal layout), so the payload lives inline with no nested allocation.

§Authority

Per ADR-006 §2.7.24 Q25.A SUPERSEDED + R20 S2-prime audit deliverable (d) §4.1.D.1. DecimalObj is the per-element carrier for TypedArray<*const DecimalObj>, the v2-raw replacement for TypedArrayData::Decimal(Arc<TypedBuffer<Arc<Decimal>>>).

§Refcount discipline

The header refcount initializes to 1 on new. HeapElement::release_elem decrements via v2_release; on return-true, Self::drop deallocates the struct. No nested buffer (Decimal payload is inline), so drop only frees Layout::new::<Self>().

Structs§

DecimalObj
Refcounted, repr(C) Decimal carrier for v2 runtime. Total: 24 bytes (header 8 + value 16).