1 // Copyright Ferdinand Majerech 2014. 2 // Distributed under the Boost Software License, Version 1.0. 3 // (See accompanying file LICENSE_1_0.txt or copy at 4 // http://www.boost.org/LICENSE_1_0.txt) 5 6 7 /// YAML utilities. 8 module io.yaml; 9 10 11 public import dyaml.all; 12 alias YAMLNode = Node; 13 14 15 /** Dump YAML to a string and return the string. 16 * 17 * Inefficient and GC-intensive at the moment, use with care. 18 */ 19 string dumpToString(YAMLNode yaml) @trusted nothrow 20 { 21 import std.exception; 22 import std.stream; 23 auto stream = new MemoryStream().assumeWontThrow; 24 Dumper(stream).dump(yaml).assumeWontThrow; 25 return cast(string)stream.data.assumeWontThrow; 26 }