get_attr_byidx_lazy

Function get_attr_byidx_lazy 

Source
pub unsafe extern "C" fn get_attr_byidx_lazy(
    context: *mut c_context,
    value: *mut value,
    state: *mut EvalState,
    i: c_uint,
    name: *mut *const c_char,
) -> *mut value
Expand description

@brief Get an attribute by index, without forcing evaluation of the attribute’s value @ingroup value_extract

Also gives you the name.

Returns the attribute value without forcing its evaluation, allowing access to lazy values. The attribute set value itself must already have been evaluated.

Attributes are returned in an unspecified order which is NOT suitable for reproducible operations. In Nix’s domain, reproducibility is paramount. The caller is responsible for sorting the attributes or storing them in an ordered map to ensure deterministic behavior in your application.

@note When Nix does sort attributes, which it does for virtually all intermediate operations and outputs, it uses byte-wise lexicographic order (equivalent to lexicographic order by Unicode scalar value for valid UTF-8). We recommend applying this same ordering for consistency.

Call nix_value_decref() when you’re done with the pointer @param[out] context Optional, stores error information @param[in] value Nix value to inspect (must be an evaluated attribute set) @param[in] state nix evaluator state @param[in] i attribute index @param[out] name will store a pointer to the attribute name, valid until state is freed @return value, NULL in case of errors