Key-value _pairs of the mapping.
Style of the mapping. If invalid, default _style will be used. If the node was loaded before, previous _style will always be used.
The represented node.
RepresenterException if a child could not be represented.
1 struct MyStruct 2 { 3 int x, y, z; 4 5 //Any D:YAML type must have a custom opCmp operator. 6 //This is used for ordering in mappings. 7 const int opCmp(ref const MyStruct s) 8 { 9 if(x != s.x){return x - s.x;} 10 if(y != s.y){return y - s.y;} 11 if(z != s.z){return z - s.z;} 12 return 0; 13 } 14 } 15 16 Node representMyStruct(ref Node node, Representer representer) 17 { 18 auto value = node.as!MyStruct; 19 auto pairs = [Node.Pair("x", value.x), 20 Node.Pair("y", value.y), 21 Node.Pair("z", value.z)]; 22 return representer.representMapping("!mystruct.tag", pairs); 23 }
Represent a mapping with specified _tag, representing children first.
This is used by representer functions that produce mappings.