Node.this

this(T value, const string tag = null) @safe

Construct a Node from a value.

Any type except for Node can be stored in a Node, but default YAML types (integers, floats, strings, timestamps, etc.) will be stored more efficiently. To create a node representing a null value, construct it from YAMLNull.

If value is a node, its value will be copied directly. The tag and other information attached to the original node will be discarded.

If value 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.

Note that to emit any non-default types you store in a node, you need a Representer to represent them in YAML - otherwise emitting will fail.

Parameters

valueValue to store in the node.
tagOverrides 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. Tag must be in full form, e.g. "tag:yaml.org,2002:int", not a shortcut, like "!!int".
this(K[] keys, V[] values, const string tag = null)

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

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.

Parameters

keysKeys of the mapping, from first to last pair.
valuesValues of the mapping, from first to last pair.
tagOverrides 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".