Node.opIndexAssign

Set element at specified index in a collection.

This method can only be called on collection nodes.

If the node is a sequence, index must be integral.

If the node is a mapping, sets the _value corresponding to the first key matching index (including conversion, so e.g. "42" matches 42).

If the node is a mapping and no key matches index, a new key-value pair is added to the mapping. In sequences the index must be in range. This ensures behavior siilar to D arrays and associative arrays.

To set element at a null index, use YAMLNull for index.

struct Node
void
opIndexAssign
(
K
V
)
(,)

Parameters

value V

Value to assign.

index K

Index of the value to set.

Throws

NodeException if the node is not a collection, index is out of range or if a non-integral index is used on a sequence node.

Meta