Get the scalar style a node had in the file it was loaded from.

This is only useful for nodes loaded from files.

This is a "hack" because a YAML application is supposed to be unaware of styles used in YAML styles, i.e. treating different styles differently is unstandard. However, determining style may be useful in some cases, e.g. YAML utilities.

May only be called on scalar nodes (nodes where node.isScalar() == true).

  1. ScalarStyle scalarStyleHack(ref const(Node) node)
    @safe nothrow
    ref const(Node) node
  2. void scalarStyleHack(ref Node node, const ScalarStyle rhs)


1 import dyaml;
2 Node node = Loader.fromString(`"42"`).load(); // loaded from a file
3 if(node.isScalar)
4 {
5     assert(node.scalarStyleHack() == ScalarStyle.DoubleQuoted);
6 }