Loader.fromString

Construct a Loader to load YAML from a string.

  1. Loader fromString(char[] data, string filename)
    struct Loader
    static @safe
    fromString
    (
    char[] data
    ,
    string filename = "<unknown>"
    )
  2. Loader fromString(string data, string filename)

Parameters

data char[]

String to load YAML from. The char[] version will overwrite its input during parsing as D:YAML reuses memory.

filename string

The filename to give to the Loader, defaults to "<unknown>"

Return Value

Type: Loader

Loader loading YAML from given string.

Throws

YAMLException if data could not be read (e.g. a decoding error)

Examples

Load a char[].

assert(Loader.fromString("42".dup).load().as!int == 42);

Load a string.

assert(Loader.fromString("42").load().as!int == 42);

Meta