Formatter

Undocumented in source.

Members

Functions

close
void close(string s)
Undocumented in source. Be warned that the author may not have intended to support it.
indentation
void indentation()
Undocumented in source. Be warned that the author may not have intended to support it.
open
void open(string s)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

indent
size_t indent;
Undocumented in source.
output
Output output;
Undocumented in source.
pending
bool pending;
Undocumented in source.

Examples

writes nested packages

import std.array : appender;
import std.string : outdent, stripLeft;

auto output = appender!string;
auto writer = writer(formatter(output));

writer.put(["a", "b", "x"]);
writer.put(["a", "b", "y"]);
writer.put(["a", "z"]);
writer.close;

const expected = `
    package a {
        package b as a.b {
            package x as a.b.x {}
            package y as a.b.y {}
        }
        package z as a.z {}
    }
    `;

assert(output.data == outdent(expected).stripLeft);

Meta