Skip to main content

build_writable_computed

Function build_writable_computed 

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

A WritableKeyPath<Root, Value> whose accessors are Rust functions.

What a client key path into a resilient struct looks like: no property descriptor to name, just a getter and a setter the client emitted. Swift builds exactly this for \FocusedValues.myFocus, where myFocus is a computed property the client declared — and the reason this exists is that FocusedValues exports no properties, so build’s External component has nothing to point at.

§Safety

slot must be a static mut in this image, used by one key path only — build explains why the heap will not do. getter must take the root in x0 and write through x8; setter must take the new value in x0 and the root in x1.