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:
parent
9cccb8bae0
commit
e891aac2e4
2 changed files with 28 additions and 0 deletions
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue