1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 06:21:14 +02:00

nix_api_value: add nix_get_attr_name_byidx get attr names without forcing

This commit is contained in:
Yorick van Pelt 2023-08-07 15:10:04 +02:00 committed by José Luis Lafuente
parent 9cccb8bae0
commit e891aac2e4
No known key found for this signature in database
GPG key ID: 8A3455EBE455489A
2 changed files with 28 additions and 0 deletions

View file

@ -207,6 +207,8 @@ bool nix_has_attr_byname(nix_c_context *context, const Value *value,
State *state, const char *name);
/** @brief Get an attribute by index in the sorted bindings
*
* Also gives you the name.
*
* Owned by the GC. Use nix_gc_decref when you're done with the pointer
* @param[out] context Optional, stores error information
@ -218,6 +220,20 @@ bool nix_has_attr_byname(nix_c_context *context, const Value *value,
*/
Value *nix_get_attr_byidx(nix_c_context *context, const Value *value,
State *state, unsigned int i, const char **name);
/** @brief Get an attribute name by index in the sorted bindings
*
* Useful when you want the name but want to avoid evaluation.
*
* Owned by the nix State
* @param[out] context Optional, stores error information
* @param[in] value Nix value to inspect
* @param[in] state nix evaluator state
* @param[in] i attribute index
* @return name, NULL in case of errors
*/
const char *nix_get_attr_name_byidx(nix_c_context *context, const Value *value,
State *state, unsigned int i);
/**@}*/
/** @name Setters
*/