Expand description
Object inspection and allocation helpers — mirrors lean.h:312–630.
Covers scalar-pointer encoding (lean_is_scalar), tag reads, the
lean_is_* predicates, the lean_to_* casts (returned as raw *mut lean_object for opacity), and the runtime-mode reads (lean_is_st,
lean_is_mt, lean_is_persistent, lean_is_exclusive,
lean_is_shared). Allocation primitives exported by libleanshared
(lean_alloc_object, lean_free_object) are declared here; the
higher-level inline allocators (lean_alloc_ctor, lean_alloc_closure,
lean_alloc_array, …) live in their category modules.
Functions§
- lean_
alloc_ ⚠object - Allocate an uninitialized Lean heap object of size
szbytes (lean.h:490). The caller is responsible for initializing the header vialean_set_st_header-equivalent writes, which only this crate’s helpers should perform. - lean_
box ⚠ - Box an unsigned integer into a scalar Lean object (
lean.h:313). - lean_
free_ ⚠object - Free a Lean heap object previously allocated with
lean_alloc_object(lean.h:491). - lean_
is_ ⚠array - True if
ois an object array (lean.h:567). - lean_
is_ ⚠closure - True if
ois a closure object (lean.h:566). - lean_
is_ ⚠ctor - Constructor objects share tags
0..=LEAN_MAX_CTOR_TAG; this is thelean_is_ctorpredicate fromlean.h:565. - lean_
is_ ⚠exclusive - True if
ois single-threaded with refcount exactly one (lean.h:592–598). - lean_
is_ ⚠external - True if
ois an external object (lean.h:574). - lean_
is_ ⚠mpz - True if
ois an MPZ (big integer) object (lean.h:570). - lean_
is_ ⚠mt - Multi-threaded test (
lean.h:515–517). - lean_
is_ ⚠persistent - Persistent test (
lean.h:524–526). - lean_
is_ ⚠promise - True if
ois a promise object (lean.h:573). - lean_
is_ ⚠ref - True if
ois a LeanRefobject (lean.h:575). - lean_
is_ ⚠sarray - True if
ois a scalar array (lean.h:568). - lean_
is_ ⚠scalar - Scalar-pointer test (
lean.h:312). Scalar values are tagged with the low bit set; the pointer never aliases a real allocation. - lean_
is_ ⚠shared - True if
ois single-threaded with refcount > 1 (lean.h:604–610). - lean_
is_ ⚠st - Single-threaded test (
lean.h:519–521). - lean_
is_ ⚠string - True if
ois a string (lean.h:569). - lean_
is_ ⚠task - True if
ois a task object (lean.h:572). - lean_
is_ ⚠thunk - True if
ois a thunk object (lean.h:571). - lean_
obj_ ⚠tag - Read the object’s “logical” tag (
lean.h:577–579): for scalar values this is the unboxed payload; otherwise it is the heap tag. - lean_
object_ ⚠byte_ size - Total byte size of
o’s allocation (lean.h:506). - lean_
object_ ⚠data_ byte_ size - Byte size of
o’s salient (initialized) storage (lean.h:513). - lean_
ptr_ ⚠other - Read the object’s
m_otherbyte (lean.h:497–499). - lean_
ptr_ ⚠tag - Read the object’s tag byte (
lean.h:493–495). - lean_
unbox ⚠ - Unbox a scalar Lean object (
lean.h:314).