kameloso.printing

Functions related to (formatting and) printing structs and classes to the local terminal, listing each member variable and their contents in an easy-to-visually-parse way.

Members

Aliases

formatObject
alias formatObject = formatObjects

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

printObject
alias printObject = printObjects

Prints out aggregate objects, with all their printable members with all their printable values.

Functions

formatObjects
void formatObjects(Sink sink, Flag!"brightTerminal" bright, Things things)

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

formatObjects
string formatObjects(Flag!"brightTerminal" bright, Things things)

Formats a struct object, with all its printable members with all their printable values. A string-returning overload that doesn't take an input range.

printObjects
void printObjects(Things things)

Prints out aggregate objects, with all their printable members with all their printable values.

Examples

printObjects(client, bot, settings);

/* Output to screen:

-- IRCClient
   string nickname               "kameloso"(8)
   string user                   "kameloso"(8)
   string ident                  "NaN"(3)
   string realName               "kameloso IRC bot"(16)

-- IRCBot
   string account                "kameloso"(8)
 string[] admins                 ["zorael"](1)
 string[] homeChannels           ["#flerrp"](1)
 string[] guestChannels          ["#d"](1)

-- IRCServer
   string address                "irc.libera.chat"(16)
   ushort port                    6667
*/

Distance between types, member names and member values are deduced automatically based on how long they are (in terms of characters). If it doesn't line up, its a bug.

See Also

Meta