Construct a Dumper writing to a file.
Construct a Dumper writing to a _stream. This is useful to e.g. write to memory.
Destroy the Dumper.
Dump one or more YAML _documents to the file/stream.
Specify YAML version string. "1.1" by default.
Write scalars in canonical form?
Set character encoding to use. UTF-8 by default.
Always explicitly write document end?
Always explicitly write document start?
Set indentation width. 2 by default. Must not be zero.
Set line break to use. Unix by default.
Set stream name. Used in debugging messages.
Specify custom Representer to use.
Specify custom Resolver to use.
Specify tag directives.
Set preferred text _width.
Write to a file:
auto node = Node([1, 2, 3, 4, 5]); Dumper("file.yaml").dump(node);
Write multiple YAML documents to a file:
auto node1 = Node([1, 2, 3, 4, 5]); auto node2 = Node("This document contains only one string"); Dumper("file.yaml").dump(node1, node2); //Or with an array: //Dumper("file.yaml").dump([node1, node2]);
Write to memory:
import std.stream; auto stream = new YMemoryStream(); auto node = Node([1, 2, 3, 4, 5]); Dumper(stream).dump(node);
Use a custom representer/resolver to support custom data types and/or implicit tags:
auto node = Node([1, 2, 3, 4, 5]); auto representer = new Representer(); auto resolver = new Resolver(); //Add representer functions / resolver expressions here... auto dumper = Dumper("file.yaml"); dumper.representer = representer; dumper.resolver = resolver; dumper.dump(node);
Dumps YAML documents to files or streams.
User specified Representer and/or Resolver can be used to support new tags / data types.
Setters are provided to affect output details (style, encoding, etc.).