A disabled default is present on this object. To use it, use one of the other constructors or a factory function.
Construct a Loader to load YAML from a file.
Construct a Loader to load YAML from a buffer.
Destroy the Loader.
Specify custom Constructor to use.
Load single YAML document.
Load all YAML documents.
Set stream name. Used in debugging messages.
Foreach over YAML documents.
Specify custom Resolver to use.
Construct a Loader to load YAML from a string (char []).
Load single YAML document from a file:
auto rootNode = Loader("file.yaml").load(); ...
Load all YAML documents from a file:
auto nodes = Loader("file.yaml").loadAll(); ...
Iterate over YAML documents in a file, lazily loading them:
1 auto loader = Loader("file.yaml"); 2 3 foreach(ref node; loader) 4 { 5 ... 6 }
Load YAML from a string:
1 char[] yaml_input = "red: '#ff0000'\n" 2 "green: '#00ff00'\n" 3 "blue: '#0000ff'".dup; 4 5 auto colors = Loader.fromString(yaml_input).load(); 6 7 foreach(string color, string value; colors) 8 { 9 import std.stdio; 10 writeln(color, " is ", value, " in HTML/CSS"); 11 }
Load a file into a buffer in memory and then load YAML from that buffer:
1 try 2 { 3 import std.file; 4 void[] buffer = std.file.read("file.yaml"); 5 auto yamlNode = Loader(buffer); 6 7 // Read data from yamlNode here... 8 } 9 catch(FileException e) 10 { 11 writeln("Failed to read file 'file.yaml'"); 12 }
Use a custom constructor/resolver to support custom data types and/or implicit tags:
1 auto constructor = new Constructor(); 2 auto resolver = new Resolver(); 3 4 // Add constructor functions / resolver expressions here... 5 6 auto loader = Loader("file.yaml"); 7 loader.constructor = constructor; 8 loader.resolver = resolver; 9 auto rootNode = loader.load(node);
Loads YAML documents from files or char[].
User specified Constructor and/or Resolver can be used to support new tags / data types.