Expand description
Constructor objects and polymorphic boxing — Rust mirrors of
lean.h:642–760 and the lean_box_uint* / lean_box_float family at
lean.h:2811–2873.
Lean’s polymorphic boxing for fixed-width unboxed values (UInt32 on
32-bit, UInt64, USize, Float, Float32) wraps the value in a
single-field constructor (tag=0, num_objs=0, scalar payload
sized for the value). The boxed form is the representation an
Array UIntN / Option UIntN / Except E UIntN field carries; the
direct unboxed form is reserved for argument and return positions in
exported Lean functions.
Each helper here threads through the lean_alloc_object extern declared
in crate::object and writes header bytes via the crate-private
LeanCtorObjectRepr layout in crate::repr. The pinned
EXPECTED_HEADER_DIGEST guarantees the field offsets match the active
lean.h.
Functions§
- lean_
alloc_ ⚠ctor - Allocate a freshly initialized constructor object — Rust mirror of
lean_alloc_ctor(lean.h:659–664). - lean_
box_ ⚠float - Box an
f64as a single-field constructor (lean.h:2855–2859). - lean_
box_ ⚠uint32 - Box a
u32as a single-field constructor (lean.h:2813–2823). - lean_
box_ ⚠uint64 - Box a
u64as a single-field constructor (lean.h:2835–2839). - lean_
box_ ⚠usize - Box a
usizeas a single-field constructor (lean.h:2845–2849). - lean_
ctor_ ⚠get_ float - Read an
f64field at byteoffsetwithin the scalar payload (lean.h:717–720). - lean_
ctor_ ⚠get_ uint8 - Read a
u8field at byteoffsetwithin the scalar payload (lean.h:697–700). - lean_
ctor_ ⚠get_ uint16 - Read a
u16field at byteoffsetwithin the scalar payload (lean.h:702–705). - lean_
ctor_ ⚠get_ uint32 - Read a
u32field at byteoffsetwithin the scalar payload (lean.h:707–710). - lean_
ctor_ ⚠get_ uint64 - Read a
u64field at byteoffsetwithin the scalar payload (lean.h:712–715). - lean_
ctor_ ⚠get_ usize - Read a
usizefield stored after the object-pointer slots (lean.h:692). - lean_
ctor_ ⚠num_ objs - Number of object-pointer fields stored in a constructor (
lean.h:644). - lean_
ctor_ ⚠obj_ cptr - Pointer to the constructor’s object-field storage (
lean.h:649–652). - lean_
ctor_ ⚠scalar_ cptr - Pointer to the constructor’s scalar payload storage
(
lean.h:654–657). Sits immediately past the object-pointer slots. - lean_
ctor_ ⚠set_ float - Write an
f64field at byteoffsetwithin the scalar payload (lean.h:752–755). - lean_
ctor_ ⚠set_ uint8 - Write a
u8field at byteoffsetwithin the scalar payload (lean.h:732–735). - lean_
ctor_ ⚠set_ uint16 - Write a
u16field at byteoffsetwithin the scalar payload (lean.h:737–740). - lean_
ctor_ ⚠set_ uint32 - Write a
u32field at byteoffsetwithin the scalar payload (lean.h:742–745). - lean_
ctor_ ⚠set_ uint64 - Write a
u64field at byteoffsetwithin the scalar payload (lean.h:747–750). - lean_
ctor_ ⚠set_ usize - Write a
usizefield at sloti(counted inusizeunits past the object-pointer slots) — mirror oflean.h:727–730. - lean_
unbox_ ⚠float - Recover the
f64payload from a constructor produced bylean_box_float(lean.h:2861–2863). - lean_
unbox_ ⚠uint32 - Recover the
u32payload from a constructor produced bylean_box_uint32(lean.h:2825–2833). - lean_
unbox_ ⚠uint64 - Recover the
u64payload from a constructor produced bylean_box_uint64(lean.h:2841–2843). - lean_
unbox_ ⚠usize - Recover the
usizepayload from a constructor produced bylean_box_usize(lean.h:2851–2853).