Node.this

Construct a node from arrays of _keys and _values.

Constructs a mapping node with key-value pairs from _keys and _values, keeping their order. Useful when order is important (ordered maps, pairs).

More...
  1. this(T value, string tag)
  2. this(K[] keys, V[] values, string tag)
    struct Node
    @serdeIgnore
    this
    (
    K
    V
    )
    (
    K[] keys
    ,
    V[] values
    ,
    const string tag = null
    )
    if (
    !(
    isSomeString!(K[]) ||
    isSomeString!(V[])
    )
    )

Parameters

values V[]

Values of the mapping, from first to last pair.

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".

Detailed Description

keys and values must have equal length.

If _keys and/or _values are nodes, they are stored directly/ Otherwise they are converted to nodes and then stored.

Examples

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

Meta