Node.this

Construct a node from an associative _array.

If keys and/or values of _array are nodes, they stored directly. Otherwise they are converted to nodes and then stored.

  1. this(T value, string tag)
  2. this(T value, string tag)
  3. this(T[] array, string tag)
  4. this(V[K] array, string tag)
    struct Node
    @trusted
    this
    (
    K
    V
    )
    (
    V[K] array
    ,
    const string tag = null
    )
  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 unordered mappings ("!!map"), ordered mappings ("!!omap"), and pairs ("!!pairs") which are all internally represented as an _array of node pairs. Tag must be in full form, e.g. "tag:yaml.org,2002:omap", not a shortcut, like "!!omap".

Examples

// Will be emitted as an unordered mapping (default for mappings)
auto map   = Node([1 : "a", 2 : "b"]);
// Will be emitted as an ordered map (overriden tag)
auto omap  = Node([1 : "a", 2 : "b"], "tag:yaml.org,2002:omap");
// Will be emitted as pairs (overriden tag)
auto pairs = Node([1 : "a", 2 : "b"], "tag:yaml.org,2002:pairs");

Meta