Function std.format.formatValue
Formats any value into Char accepting OutputRange, using the given FormatSpec.
						
				void formatValue(Writer, T, Char)
				(
				
				  auto ref Writer w,
				
				  auto ref T val,
				
				  const ref FormatSpec!Char f
				
				);
						
					
				Aggregates
struct, union, class, and interface are formatted by calling toString.
 toString should have one of the following signatures:
void toString(W)(ref W w, const ref FormatSpec fmt)
void toString(W)(ref W w)
string toString(); Where W is an output range
 which accepts characters. The template type does not have to be called W.
The following overloads are also accepted for legacy reasons or for use in virtual functions. It's recommended that any new code forgo these overloads if possible for speed and attribute acceptance reasons.
void toString(scope void delegate(const(char)[]) sink, const ref FormatSpec fmt);
void toString(scope void delegate(const(char)[]) sink, string fmt);
void toString(scope void delegate(const(char)[]) sink);For the class objects which have input range interface,
- If the instance toStringhas overriddenObject, it is used..toString 
- Otherwise, the objects are formatted as input range.
 For the struct and union objects which does not have toString,
 
- If they have range interface, formatted as input range.
- Otherwise, they are formatted like Type(field1, filed2, ...).
Otherwise, are formatted just as their type name.
Parameters
| Name | Description | 
|---|---|
| w | The output range to write to. | 
| val | The value to write. | 
| f | The FormatSpecdefining how to write the value. | 
Example
The following code compares the use of formatValue and formattedWrite.
import stdExample
bools are formatted as "true" or "false" with %s and as 1 or
 0 with integral-specific format specs.
import stdExample
null literal is formatted as "null".
import stdExample
Integrals are formatted like printf.
import stdExample
Floating-point values are formatted like printf
import stdExample
Individual characters (char, wchar, or dchar`) are formatted as
 Unicode characters with %s and as integers with integral-specific format
 specs.
import stdExample
Strings are formatted like printf
import stdExample
Static-size arrays are formatted as dynamic arrays.
import stdExample
Dynamic arrays are formatted as input ranges.
Specializations
- void[]is formatted like- ubyte[].
- Const array is converted to input range by removing its qualifier.
import stdExample
Associative arrays are formatted by using ':' and ", " as
 separators, and enclosed by '[' and ']'.
import stdExample
enums are formatted like their base value
import stdExample
Formatting a struct by defining a method toString, which takes an output
 range.
 It's recommended that any toString using output ranges
 use put rather than use the put method of the range
 directly.
import stdExample
Another example of formatting a struct with a defined toString,
 this time using the scope delegate method.
This method is now discouraged for non-virtual functions. If possible, please use the output range method instead.
static struct Point
{
    int x, y;
    void toString(scope void delegate(scope const(char)[]) @safe sink,
                  FormatSpec!char fmt) const
    {
        sink("(");
        sinkExample
Pointers are formatted as hex integers.
import stdExample
SIMD vectors are formatted as arrays.
import coreExample
Delegates are formatted by ReturnType delegate(Parameters) FunctionAttributes
import stdExample
import stdAuthors
Walter Bright, Andrei Alexandrescu, and Kenji Hara