Struct Value
Wrapper around a host-managed Nix value identifier.
struct Value;
Provides typed accessors and constructors that delegate to host-imported functions. Values are identified by opaque ValueId handles; the host owns the underlying storage.
Methods
| Name | Description |
|---|---|
call
(args)
|
Eagerly calls this value as a function with the given arguments. |
getAttr
(attrName)
|
Looks up an attribute by name, returning a zero-id value if not found. |
getAttrset
(allocator, names, values, count)
|
Returns parallel arrays of attribute names and values. |
getBool
()
|
Returns the boolean payload of this value. |
getFloat
()
|
Returns the float payload of this value. |
getInt
()
|
Returns the integer payload of this value. |
getList
(a)
|
Returns the list elements as an arena-backed slice. |
getPath
(a)
|
Returns the path string of this value as an arena-backed slice. |
getString
(a)
|
Returns the string content of this value as an arena-backed slice. |
getType
()
|
Returns the Nix type tag for this value. |
hasAttr
(attrName)
|
Returns whether this attribute set contains the given key. |
lazyCall
(args)
|
Lazily applies this function to the given arguments. |
makeAttrset
(allocator, attrs)
|
Constructs a Nix attribute set from name-value pairs. |
makeBool
(b)
|
Constructs a Nix boolean value. |
makeFloat
(f)
|
Constructs a Nix float value. |
makeInt
(n)
|
Constructs a Nix integer value. |
makeList
(items)
|
Constructs a Nix list from a slice of values. |
makeNull
()
|
Constructs a Nix null value. |
makePath
(rel)
|
Constructs a Nix path value relative to this base path. |
makeString
(s)
|
Constructs a Nix string value from a D character slice. |
readFile
(a)
|
Reads the file at this path value, returning an arena-backed slice. |