|
Nix 2.34.6
Nix, the purely functional package manager: C API (experimental)
|
nix_value type and core operations for working with Nix values More...
Data Structures | |
| struct | nix_value |
| A Nix language value, or thunk that may evaluate to a value. More... | |
Enumerations | |
| enum | ValueType { NIX_TYPE_THUNK , NIX_TYPE_INT , NIX_TYPE_FLOAT , NIX_TYPE_BOOL , NIX_TYPE_STRING , NIX_TYPE_PATH , NIX_TYPE_NULL , NIX_TYPE_ATTRS , NIX_TYPE_LIST , NIX_TYPE_FUNCTION , NIX_TYPE_EXTERNAL , NIX_TYPE_FAILED } |
| Represents the state of a Nix value. More... | |
Functions | |
| nix_err | nix_value_incref (nix_c_context *context, nix_value *value) |
| Increment the garbage collector reference counter for the given nix_value. | |
| nix_err | nix_value_decref (nix_c_context *context, nix_value *value) |
| Decrement the garbage collector reference counter for the given object. | |
nix_value type and core operations for working with Nix values
| enum ValueType |
Represents the state of a Nix value.
Thunk values (NIX_TYPE_THUNK) change to their final, unchanging type when forced.
| Enumerator | |
|---|---|
| NIX_TYPE_THUNK | Unevaluated expression Thunks often contain an expression and closure, but may contain other representations too. Their state is mutable, unlike that of the other types. |
| NIX_TYPE_INT | A 64 bit signed integer. |
| NIX_TYPE_FLOAT | IEEE 754 double precision floating point number. |
| NIX_TYPE_BOOL | Boolean true or false value. |
| NIX_TYPE_STRING | String value with context. String content may contain arbitrary bytes, not necessarily UTF-8. |
| NIX_TYPE_PATH | Filesystem path. |
| NIX_TYPE_NULL | Null value. |
| NIX_TYPE_ATTRS | Attribute set (key-value mapping). |
| NIX_TYPE_LIST | Ordered list of values. |
| NIX_TYPE_FUNCTION | Function (lambda or builtin). |
| NIX_TYPE_EXTERNAL | External value from C++ plugins or C API.
|
| nix_err nix_value_decref | ( | nix_c_context * | context, |
| nix_value * | value ) |
Decrement the garbage collector reference counter for the given object.
When the counter reaches zero, the nix_value object becomes invalid. The data referenced by nix_value may not be deallocated until the memory garbage collector has run, but deallocation is not guaranteed.
| [out] | context | Optional, stores error information |
| [in] | Value | The object to stop referencing |
| nix_err nix_value_incref | ( | nix_c_context * | context, |
| nix_value * | value ) |
Increment the garbage collector reference counter for the given nix_value.
The Nix language evaluator C API keeps track of alive objects by reference counting. When you're done with a refcounted pointer, call nix_value_decref().
| [out] | context | Optional, stores error information |
| [in] | Value | The object to keep alive |