diff --git a/source/dyaml/loader.d b/source/dyaml/loader.d index 9f07663..4e5989f 100644 --- a/source/dyaml/loader.d +++ b/source/dyaml/loader.d @@ -53,7 +53,7 @@ import dyaml.token; /// } /// -------------------- /// -/// Load YAML from memory: +/// Load YAML from a string: /// -------------------- /// char[] yaml_input = "red: '#ff0000'\n" /// "green: '#00ff00'\n" @@ -68,6 +68,22 @@ import dyaml.token; /// } /// -------------------- /// +/// Load a file into a buffer in memory and then load YAML from that buffer: +/// -------------------- +/// try +/// { +/// import std.file; +/// void[] buffer = std.file.read("file.yaml"); +/// auto yamlNode = Loader(buffer); +/// +/// // Read data from yamlNode here... +/// } +/// catch(FileException e) +/// { +/// writeln("Failed to read file 'file.yaml'"); +/// } +/// -------------------- +/// /// Use a custom constructor/resolver to support custom data types and/or implicit tags: /// -------------------- /// auto constructor = new Constructor();