std :: serial::value
Struct std::Value
struct Value {
int kind;
long long int_val;
double float_val;
int bool_val;
?&heap char str_val;
struct Vec<struct Value> arr_val;
struct Vec<struct ObjectEntry> obj_val;
}Fields
one of the VAL_* constants above
VAL_INT
VAL_FLOAT
VAL_BOOL
VAL_STRING — heap-allocated, NUL-terminated, owned;
empty (null) for every other 'kind'
VAL_ARRAY — elements by value
VAL_OBJECT — key/value entries by value
Methods
copies s
empty; grow with v.array_push
empty; grow with v.object_set
Array/Object element access (read-only views — the returned reference aliases storage owned by this Value, don't free it separately). 'array_at' trusts 'idx' is in range (see array_len()); 'object_get' is the one nullable lookup — no entry for 'key' is a real, expected outcome, not a caller error.
The idx-th entry of an object, in insertion order (for iterating a VAL_OBJECT's keys — e.g. a YAML/JSON map whose order matters): its key ("" if the entry's key allocation failed) and its value. Like array_at, both trust 'idx' < object_len().
Empty (null case) if the key isn't present.
Array/Object building. Both take ownership of 'v' (see the file-level ownership note above).
Deep copy / recursive release of the whole tree.
= drop()
A fresh String holding this tree in format f.
Parses text in format f; *ok (if non-null) is 1 on success, else 0.