Skip to main content

build_computed

Function build_computed 

Source
pub unsafe fn build_computed(
    slot: &'static mut ComputedSlot,
    root: &[u8],
    value: &[u8],
    getter: *const c_void,
) -> u64
Expand description

A KeyPath<Root, Value> whose getter is a Rust function.

OutlineGroup needs KeyPath<Element, Data?>, and no type in any linked framework has a recursive children property with an exported property descriptor — so there is nothing for the Slot shape’s External component to name. A get-only computed component needs no such property: it carries a getter and an identity, and the runtime calls the getter.

The key path’s class metadata is KeyPath<Root, Value>, built by the runtime from the two mangled names below. That matters beyond type checking: OutlineGroup.init is passed metadata only for its Leaf, and recovers Data, ID and Element from the key paths it is handed.

§Safety

slot must be a static mut in this image — the pattern’s internal references are 32-bit, and build explains why that rules out the heap. getter must have the thunk shape below: root in x0, result through x8.