Skip to content

Commit 1300aad

Browse files
committed
revert some changes in format: for some API the appender can accept only arrays, not chars.
1 parent 1115b6d commit 1300aad

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

source/mir/format.d

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ struct FormattedFloating(T)
277277

278278
///
279279
void toString(C = char, W)(scope ref W w) scope const
280-
if (isSomeChar!C && isOutputRange!(W, C))
280+
if (isSomeChar!C)
281281
{
282282
C[512] buf = void;
283283
auto n = printFloatingPoint(value, spec, buf);
@@ -304,7 +304,7 @@ struct HexAddress(T)
304304

305305
///
306306
void toString(C = char, W)(scope ref W w) scope const
307-
if (isSomeChar!C && isOutputRange!(W, C))
307+
if (isSomeChar!C)
308308
{
309309
enum N = T.sizeof * 2;
310310
static if(isFastBuffer!W)
@@ -421,7 +421,7 @@ version (mir_test) unittest
421421
Decodes `char` `c` to the form `u00XX`, where `XX` is 2 hexadecimal characters.
422422
+/
423423
ref W put_xXX(C = char, W)(scope return ref W w, char c)
424-
if (isSomeChar!C && isOutputRange!(W, C))
424+
if (isSomeChar!C)
425425
{
426426
ubyte[2] spl;
427427
spl[0] = c >> 4;
@@ -438,7 +438,7 @@ ref W put_xXX(C = char, W)(scope return ref W w, char c)
438438
Decodes `char` `c` to the form `u00XX`, where `XX` is 2 hexadecimal characters.
439439
+/
440440
ref W put_uXXXX(C = char, W)(scope return ref W w, char c)
441-
if (isSomeChar!C && isOutputRange!(W, C))
441+
if (isSomeChar!C)
442442
{
443443
ubyte[2] spl;
444444
spl[0] = c >> 4;
@@ -457,7 +457,7 @@ ref W put_uXXXX(C = char, W)(scope return ref W w, char c)
457457
Decodes ushort `c` to the form `uXXXX`, where `XXXX` is 2 hexadecimal characters.
458458
+/
459459
ref W put_uXXXX(C = char, W)(scope return ref W w, ushort c)
460-
if (isSomeChar!C && isOutputRange!(W, C))
460+
if (isSomeChar!C)
461461
{
462462
ubyte[4] spl;
463463
spl[0] = (c >> 12) & 0xF;
@@ -476,7 +476,7 @@ ref W put_uXXXX(C = char, W)(scope return ref W w, ushort c)
476476

477477
///
478478
ref W printElement(C, EscapeFormat escapeFormat = EscapeFormat.ion, W)(scope return ref W w, scope const(C)[] c)
479-
if (isSomeChar!C && isOutputRange!(W, C))
479+
if (isSomeChar!C)
480480
{
481481
static immutable C[1] quote = '\"';
482482
return w
@@ -487,7 +487,7 @@ ref W printElement(C, EscapeFormat escapeFormat = EscapeFormat.ion, W)(scope ret
487487

488488
///
489489
ref W printElement(C = char, EscapeFormat escapeFormat = EscapeFormat.ion, W, T)(scope return ref W w, scope auto ref const T c)
490-
if (!isSomeString!T && isOutputRange!(W, C))
490+
if (!isSomeString!T)
491491
{
492492
return w.print!C(c);
493493
}
@@ -496,7 +496,7 @@ ref W printElement(C = char, EscapeFormat escapeFormat = EscapeFormat.ion, W, T)
496496
Multiargument overload.
497497
+/
498498
ref W print(C = char, W, Args...)(scope return ref W w, scope auto ref const Args args)
499-
if (isSomeChar!C && isOutputRange!(W, C) && Args.length > 1)
499+
if (isSomeChar!C && Args.length > 1)
500500
{
501501
foreach(i, ref c; args)
502502
static if (i < Args.length - 1)
@@ -507,7 +507,7 @@ ref W print(C = char, W, Args...)(scope return ref W w, scope auto ref const Arg
507507

508508
/// Prints enums
509509
ref W print(C = char, W, T)(scope return ref W w, const T c)
510-
if (isSomeChar!C && isOutputRange!(W, C) && is(T == enum))
510+
if (isSomeChar!C && is(T == enum))
511511
{
512512
import mir.enums: getEnumIndex, enumStrings;
513513
import mir.utility: _expect;
@@ -544,7 +544,7 @@ version (mir_test) unittest
544544

545545
/// Prints boolean
546546
ref W print(C = char, W)(scope return ref W w, bool c)
547-
if (isSomeChar!C && isOutputRange!(W, C))
547+
if (isSomeChar!C)
548548
{
549549
enum N = 5;
550550
static if(isFastBuffer!W)
@@ -574,7 +574,7 @@ version (mir_test) unittest
574574
/// Prints associative array
575575
pragma(inline, false)
576576
ref W print(C = char, W, V, K)(scope return ref W w, scope const V[K] c)
577-
if (isSomeChar!C && isOutputRange!(W, C))
577+
if (isSomeChar!C)
578578
{
579579
enum C left = '[';
580580
enum C right = ']';
@@ -609,7 +609,7 @@ version (mir_test) unittest
609609
/// Prints array
610610
pragma(inline, false)
611611
ref W print(C = char, W, T)(scope return ref W w, scope const(T)[] c)
612-
if (isSomeChar!C && isOutputRange!(W, C) && !isSomeChar!T)
612+
if (isSomeChar!C && !isSomeChar!T)
613613
{
614614
enum C left = '[';
615615
enum C right = ']';
@@ -640,7 +640,7 @@ version (mir_test) unittest
640640
/// Prints escaped character in the form `'c'`.
641641
pragma(inline, false)
642642
ref W print(C = char, W)(scope return ref W w, char c)
643-
if (isSomeChar!C && isOutputRange!(W, C))
643+
if (isSomeChar!C)
644644
{
645645
w.put('\'');
646646
if (c >= 0x20)
@@ -696,15 +696,15 @@ version (mir_test) unittest
696696

697697
/// Prints some string
698698
ref W print(C = char, W)(scope return ref W w, scope const(C)[] c)
699-
if (isSomeChar!C && isOutputRange!(W, C))
699+
if (isSomeChar!C)
700700
{
701701
w.put(c);
702702
return w;
703703
}
704704

705705
/// Prints integers
706706
ref W print(C = char, W, I)(scope return ref W w, const I c)
707-
if (isSomeChar!C && isOutputRange!(W, C) && isIntegral!I && !is(I == enum))
707+
if (isSomeChar!C && isIntegral!I && !is(I == enum))
708708
{
709709
static if (I.sizeof == 16)
710710
enum N = 39;
@@ -724,7 +724,7 @@ ref W print(C = char, W, I)(scope return ref W w, const I c)
724724

725725
/// Prints floating point numbers
726726
ref W print(C = char, W, T)(scope return ref W w, const T c, NumericSpec spec = NumericSpec.init)
727-
if(isSomeChar!C && isOutputRange!(W, C) && is(T == float) || is(T == double) || is(T == real))
727+
if(isSomeChar!C && is(T == float) || is(T == double) || is(T == real))
728728
{
729729
import mir.bignum.decimal;
730730
auto decimal = Decimal!(T.mant_dig < 64 ? 1 : 2)(c);
@@ -817,7 +817,7 @@ unittest
817817
/// Prints structs and unions
818818
pragma(inline, false)
819819
ref W print(C = char, W, T)(scope return ref W w, ref const T c)
820-
if (isSomeChar!C && isOutputRange!(W, C) && is(T == struct) || is(T == union) && !is(T : NumericSpec))
820+
if (isSomeChar!C && is(T == struct) || is(T == union) && !is(T : NumericSpec))
821821
{
822822
static if (__traits(hasMember, T, "toString"))
823823
{
@@ -880,7 +880,7 @@ ref W print(C = char, W, T)(scope return ref W w, ref const T c)
880880
// FUTURE: remove it
881881
pragma(inline, false)
882882
ref W print(C = char, W, T)(scope return ref W w, scope const T c)
883-
if (isSomeChar!C && isOutputRange!(W, C) && is(T == struct) || is(T == union))
883+
if (isSomeChar!C && is(T == struct) || is(T == union))
884884
{
885885
return print!(C, W, T)(w, c);
886886
}
@@ -903,7 +903,7 @@ version (mir_test) unittest
903903
/// Prints classes and interfaces
904904
pragma(inline, false)
905905
ref W print(C = char, W, T)(scope return ref W w, scope const T c)
906-
if (isSomeChar!C && isOutputRange!(W, C) && is(T == class) || is(T == interface))
906+
if (isSomeChar!C && is(T == class) || is(T == interface))
907907
{
908908
enum C[4] Null = "null";
909909
static if (__traits(hasMember, T, "toString") || __traits(compiles, { scope const(C)[] string_of_c = c; }))
@@ -969,7 +969,7 @@ version (mir_test) unittest
969969

970970
///
971971
ref W printStaticString(C, size_t N, W)(scope return ref W w, ref scope const C[N] c)
972-
if (isSomeChar!C && isOutputRange!(W, C) && is(C == char) || is(C == wchar) || is(C == dchar))
972+
if (isSomeChar!C && is(C == char) || is(C == wchar) || is(C == dchar))
973973
{
974974
static if (isFastBuffer!W)
975975
{
@@ -1017,7 +1017,7 @@ template isFastBuffer(W)
10171017

10181018
///
10191019
ref W printZeroPad(C = char, W, I)(scope return ref W w, const I c, size_t minimalLength)
1020-
if (isSomeChar!C && isOutputRange!(W, C) && isIntegral!I && !is(I == enum))
1020+
if (isSomeChar!C && isIntegral!I && !is(I == enum))
10211021
{
10221022
static if (I.sizeof == 16)
10231023
enum N = 39;

0 commit comments

Comments
 (0)