mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 13:40:20 +03:00
Even more scope for FormatSpec
This commit is contained in:
parent
7a2bbdedab
commit
bc3dd0afda
4 changed files with 12 additions and 11 deletions
|
@ -1838,7 +1838,7 @@ assert(equal(rbt[], [5]));
|
||||||
*/
|
*/
|
||||||
static if (is(typeof((){FormatSpec!(char) fmt; formatValue((const(char)[]) {}, ConstRange.init, fmt);})))
|
static if (is(typeof((){FormatSpec!(char) fmt; formatValue((const(char)[]) {}, ConstRange.init, fmt);})))
|
||||||
{
|
{
|
||||||
void toString(scope void delegate(const(char)[]) sink, const ref FormatSpec!char fmt) const
|
void toString(scope void delegate(const(char)[]) sink, scope const ref FormatSpec!char fmt) const
|
||||||
{
|
{
|
||||||
sink("RedBlackTree(");
|
sink("RedBlackTree(");
|
||||||
sink.formatValue(this[], fmt);
|
sink.formatValue(this[], fmt);
|
||||||
|
|
|
@ -615,7 +615,7 @@ public:
|
||||||
{
|
{
|
||||||
import std.format : FormatSpec, formatValue;
|
import std.format : FormatSpec, formatValue;
|
||||||
// Needs to be a template because of DMD @@BUG@@ 13737.
|
// Needs to be a template because of DMD @@BUG@@ 13737.
|
||||||
void toString()(scope void delegate(const(char)[]) sink, FormatSpec!char fmt)
|
void toString()(scope void delegate(const(char)[]) sink, scope const ref FormatSpec!char fmt)
|
||||||
{
|
{
|
||||||
sink.formatValue(get!real, fmt);
|
sink.formatValue(get!real, fmt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1231,7 +1231,7 @@ if (distinctFieldNames!(Specs))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
void toString(DG, Char)(scope DG sink, const ref FormatSpec!Char fmt) const
|
void toString(DG, Char)(scope DG sink, scope const ref FormatSpec!Char fmt) const
|
||||||
{
|
{
|
||||||
import std.format : formatElement, formattedWrite, FormatException;
|
import std.format : formatElement, formattedWrite, FormatException;
|
||||||
if (fmt.nested)
|
if (fmt.nested)
|
||||||
|
@ -1287,9 +1287,10 @@ if (distinctFieldNames!(Specs))
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
const spec = fmt.spec;
|
||||||
throw new FormatException(
|
throw new FormatException(
|
||||||
"Expected '%s' or '%(...%)' or '%(...%|...%)' format specifier for type '" ~
|
"Expected '%s' or '%(...%)' or '%(...%|...%)' format specifier for type '" ~
|
||||||
Unqual!(typeof(this)).stringof ~ "', not '%" ~ fmt.spec ~ "'.");
|
Unqual!(typeof(this)).stringof ~ "', not '%" ~ spec ~ "'.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2780,7 +2781,7 @@ Params:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
void toString(W)(ref W writer, const ref FormatSpec!char fmt)
|
void toString(W)(ref W writer, scope const ref FormatSpec!char fmt)
|
||||||
if (isOutputRange!(W, char))
|
if (isOutputRange!(W, char))
|
||||||
{
|
{
|
||||||
import std.range.primitives : put;
|
import std.range.primitives : put;
|
||||||
|
@ -2792,7 +2793,7 @@ Params:
|
||||||
|
|
||||||
//@@@DEPRECATED_2.086@@@
|
//@@@DEPRECATED_2.086@@@
|
||||||
deprecated("To be removed after 2.086. Please use the output range overload instead.")
|
deprecated("To be removed after 2.086. Please use the output range overload instead.")
|
||||||
void toString()(scope void delegate(const(char)[]) sink, const ref FormatSpec!char fmt)
|
void toString()(scope void delegate(const(char)[]) sink, scope const ref FormatSpec!char fmt)
|
||||||
{
|
{
|
||||||
if (isNull)
|
if (isNull)
|
||||||
{
|
{
|
||||||
|
@ -2807,7 +2808,7 @@ Params:
|
||||||
// Issue 14940
|
// Issue 14940
|
||||||
//@@@DEPRECATED_2.086@@@
|
//@@@DEPRECATED_2.086@@@
|
||||||
deprecated("To be removed after 2.086. Please use the output range overload instead.")
|
deprecated("To be removed after 2.086. Please use the output range overload instead.")
|
||||||
void toString()(scope void delegate(const(char)[]) @safe sink, const ref FormatSpec!char fmt)
|
void toString()(scope void delegate(const(char)[]) @safe sink, scope const ref FormatSpec!char fmt)
|
||||||
{
|
{
|
||||||
if (isNull)
|
if (isNull)
|
||||||
{
|
{
|
||||||
|
@ -3513,7 +3514,7 @@ Params:
|
||||||
{
|
{
|
||||||
import std.format : FormatSpec, formatValue;
|
import std.format : FormatSpec, formatValue;
|
||||||
// Needs to be a template because of DMD @@BUG@@ 13737.
|
// Needs to be a template because of DMD @@BUG@@ 13737.
|
||||||
void toString()(scope void delegate(const(char)[]) sink, const ref FormatSpec!char fmt)
|
void toString()(scope void delegate(const(char)[]) sink, scope const ref FormatSpec!char fmt)
|
||||||
{
|
{
|
||||||
if (isNull)
|
if (isNull)
|
||||||
{
|
{
|
||||||
|
@ -3967,7 +3968,7 @@ Params:
|
||||||
{
|
{
|
||||||
import std.format : FormatSpec, formatValue;
|
import std.format : FormatSpec, formatValue;
|
||||||
// Needs to be a template because of DMD @@BUG@@ 13737.
|
// Needs to be a template because of DMD @@BUG@@ 13737.
|
||||||
void toString()(scope void delegate(const(char)[]) sink, const ref FormatSpec!char fmt)
|
void toString()(scope void delegate(const(char)[]) sink, scope const ref FormatSpec!char fmt)
|
||||||
{
|
{
|
||||||
if (isNull)
|
if (isNull)
|
||||||
{
|
{
|
||||||
|
@ -7357,7 +7358,7 @@ struct Typedef(T, T init = T.init, string cookie=null)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
void toString(this T, W)(ref W writer, const ref FormatSpec!char fmt)
|
void toString(this T, W)(ref W writer, scope const ref FormatSpec!char fmt)
|
||||||
if (isOutputRange!(W, char))
|
if (isOutputRange!(W, char))
|
||||||
{
|
{
|
||||||
formatValue(writer, Typedef_payload, fmt);
|
formatValue(writer, Typedef_payload, fmt);
|
||||||
|
|
|
@ -2453,7 +2453,7 @@ public:
|
||||||
* $(LI $(B %x) formats the intervals as a [low .. high$(RPAREN) range of lowercase hex characters)
|
* $(LI $(B %x) formats the intervals as a [low .. high$(RPAREN) range of lowercase hex characters)
|
||||||
* $(LI $(B %X) formats the intervals as a [low .. high$(RPAREN) range of uppercase hex characters)
|
* $(LI $(B %X) formats the intervals as a [low .. high$(RPAREN) range of uppercase hex characters)
|
||||||
*/
|
*/
|
||||||
void toString(Writer)(scope Writer sink, const ref FormatSpec!char fmt) /* const */
|
void toString(Writer)(scope Writer sink, scope const ref FormatSpec!char fmt) /* const */
|
||||||
{
|
{
|
||||||
import std.format : formatValue;
|
import std.format : formatValue;
|
||||||
auto range = byInterval;
|
auto range = byInterval;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue