Node.this

Construct a node from an _array.

If _array is an _array of nodes or pairs, it is stored directly. Otherwise, every value in the array is converted to a node, and those nodes are stored.

  1. this(T value, string tag)
  2. this(T value, string tag)
  3. this(T[] array, string tag)
    struct Node
    @trusted
    this
    (
    T
    )
    (
    T[] array
    ,
    const string tag = null
    )
    if (
    !isSomeString!(T[])
    )
  4. this(V[K] array, string tag)
  5. this(K[] keys, V[] values, string tag)

Parameters

tag string

Overrides tag of the node when emitted, regardless of tag determined by Representer. Representer uses this to determine YAML data type when a D data type maps to multiple different YAML data types. This is used to differentiate between YAML sequences ("!!seq") and sets ("!!set"), which both are internally represented as an array_ of nodes. Tag must be in full form, e.g. "tag:yaml.org,2002:set", not a shortcut, like "!!set".

Examples

// Will be emitted as a sequence (default for arrays)
auto seq = Node([1, 2, 3, 4, 5]);
// Will be emitted as a set (overriden tag)
auto set = Node([1, 2, 3, 4, 5], "tag:yaml.org,2002:set");

Meta