formatObjects

Formats an aggregate object, with all its printable members with all their printable values. Overload that writes to a passed output range sink.

  1. void formatObjects(Sink sink, Flag!"brightTerminal" bright, Things things)
    void
    formatObjects
    (
    Flag!"all" all = No.all
    Flag!"coloured" coloured = Yes.coloured
    Sink
    Things...
    )
    (
    auto ref Sink sink
    ,
    const Flag!"brightTerminal" bright
    ,
    auto ref Things things
    )
    if (
    (Things.length > 0) &&
    allSatisfy!(isAggregateType, Things)
    &&
    isOutputRange!(Sink, char[])
    )
  2. string formatObjects(Flag!"brightTerminal" bright, Things things)

Parameters

all

Whether or not to also display members marked as Unserialisable; usually transitive information that doesn't carry between program runs. Also those annotated Hidden.

coloured

Whether to display in colours or not.

sink Sink

Output range to write to.

bright Flag!"brightTerminal"

Whether or not to format for a bright terminal background.

things Things

Variadic list of aggregate objects to enumerate and format.

Examples

struct Foo
{
    int foo = 42;
    string bar = "arr matey";
    float f = 3.14f;
    double d = 9.99;
}

Foo foo, bar;
Appender!(char[]) sink;

sink.formatObjects!(Yes.all, Yes.coloured)(foo);
sink.formatObjects!(No.all, No.coloured)(bar);
writeln(sink.data);

Meta