| ... | @@ -78,7 +78,7 @@ fn peekIsAlign(comptime fmt: []const u8) bool { | ... | @@ -78,7 +78,7 @@ fn peekIsAlign(comptime fmt: []const u8) bool { |
| 78 | pub fn format( | 78 | pub fn format( |
| 79 | context: var, | 79 | context: var, |
| 80 | comptime Errors: type, | 80 | comptime Errors: type, |
| 81 | output: fn (@TypeOf(context), []const u8) Errors!void, | 81 | comptime output: fn (@TypeOf(context), []const u8) Errors!void, |
| 82 | comptime fmt: []const u8, | 82 | comptime fmt: []const u8, |
| 83 | args: var, | 83 | args: var, |
| 84 | ) Errors!void { | 84 | ) Errors!void { |
| ... | @@ -326,7 +326,7 @@ pub fn formatType( | ... | @@ -326,7 +326,7 @@ pub fn formatType( |
| 326 | options: FormatOptions, | 326 | options: FormatOptions, |
| 327 | context: var, | 327 | context: var, |
| 328 | comptime Errors: type, | 328 | comptime Errors: type, |
| 329 | output: fn (@TypeOf(context), []const u8) Errors!void, | 329 | comptime output: fn (@TypeOf(context), []const u8) Errors!void, |
| 330 | max_depth: usize, | 330 | max_depth: usize, |
| 331 | ) Errors!void { | 331 | ) Errors!void { |
| 332 | if (comptime std.mem.eql(u8, fmt, "*")) { | 332 | if (comptime std.mem.eql(u8, fmt, "*")) { |
| ... | @@ -488,7 +488,7 @@ fn formatValue( | ... | @@ -488,7 +488,7 @@ fn formatValue( |
| 488 | options: FormatOptions, | 488 | options: FormatOptions, |
| 489 | context: var, | 489 | context: var, |
| 490 | comptime Errors: type, | 490 | comptime Errors: type, |
| 491 | output: fn (@TypeOf(context), []const u8) Errors!void, | 491 | comptime output: fn (@TypeOf(context), []const u8) Errors!void, |
| 492 | ) Errors!void { | 492 | ) Errors!void { |
| 493 | if (comptime std.mem.eql(u8, fmt, "B")) { | 493 | if (comptime std.mem.eql(u8, fmt, "B")) { |
| 494 | return formatBytes(value, options, 1000, context, Errors, output); | 494 | return formatBytes(value, options, 1000, context, Errors, output); |
| ... | @@ -510,7 +510,7 @@ pub fn formatIntValue( | ... | @@ -510,7 +510,7 @@ pub fn formatIntValue( |
| 510 | options: FormatOptions, | 510 | options: FormatOptions, |
| 511 | context: var, | 511 | context: var, |
| 512 | comptime Errors: type, | 512 | comptime Errors: type, |
| 513 | output: fn (@TypeOf(context), []const u8) Errors!void, | 513 | comptime output: fn (@TypeOf(context), []const u8) Errors!void, |
| 514 | ) Errors!void { | 514 | ) Errors!void { |
| 515 | comptime var radix = 10; | 515 | comptime var radix = 10; |
| 516 | comptime var uppercase = false; | 516 | comptime var uppercase = false; |
| ... | @@ -552,7 +552,7 @@ fn formatFloatValue( | ... | @@ -552,7 +552,7 @@ fn formatFloatValue( |
| 552 | options: FormatOptions, | 552 | options: FormatOptions, |
| 553 | context: var, | 553 | context: var, |
| 554 | comptime Errors: type, | 554 | comptime Errors: type, |
| 555 | output: fn (@TypeOf(context), []const u8) Errors!void, | 555 | comptime output: fn (@TypeOf(context), []const u8) Errors!void, |
| 556 | ) Errors!void { | 556 | ) Errors!void { |
| 557 | if (fmt.len == 0 or comptime std.mem.eql(u8, fmt, "e")) { | 557 | if (fmt.len == 0 or comptime std.mem.eql(u8, fmt, "e")) { |
| 558 | return formatFloatScientific(value, options, context, Errors, output); | 558 | return formatFloatScientific(value, options, context, Errors, output); |
| ... | @@ -569,7 +569,7 @@ pub fn formatText( | ... | @@ -569,7 +569,7 @@ pub fn formatText( |
| 569 | options: FormatOptions, | 569 | options: FormatOptions, |
| 570 | context: var, | 570 | context: var, |
| 571 | comptime Errors: type, | 571 | comptime Errors: type, |
| 572 | output: fn (@TypeOf(context), []const u8) Errors!void, | 572 | comptime output: fn (@TypeOf(context), []const u8) Errors!void, |
| 573 | ) Errors!void { | 573 | ) Errors!void { |
| 574 | if (fmt.len == 0) { | 574 | if (fmt.len == 0) { |
| 575 | return output(context, bytes); | 575 | return output(context, bytes); |
| ... | @@ -590,7 +590,7 @@ pub fn formatAsciiChar( | ... | @@ -590,7 +590,7 @@ pub fn formatAsciiChar( |
| 590 | options: FormatOptions, | 590 | options: FormatOptions, |
| 591 | context: var, | 591 | context: var, |
| 592 | comptime Errors: type, | 592 | comptime Errors: type, |
| 593 | output: fn (@TypeOf(context), []const u8) Errors!void, | 593 | comptime output: fn (@TypeOf(context), []const u8) Errors!void, |
| 594 | ) Errors!void { | 594 | ) Errors!void { |
| 595 | return output(context, @as(*const [1]u8, &c)[0..]); | 595 | return output(context, @as(*const [1]u8, &c)[0..]); |
| 596 | } | 596 | } |
| ... | @@ -600,7 +600,7 @@ pub fn formatBuf( | ... | @@ -600,7 +600,7 @@ pub fn formatBuf( |
| 600 | options: FormatOptions, | 600 | options: FormatOptions, |
| 601 | context: var, | 601 | context: var, |
| 602 | comptime Errors: type, | 602 | comptime Errors: type, |
| 603 | output: fn (@TypeOf(context), []const u8) Errors!void, | 603 | comptime output: fn (@TypeOf(context), []const u8) Errors!void, |
| 604 | ) Errors!void { | 604 | ) Errors!void { |
| 605 | try output(context, buf); | 605 | try output(context, buf); |
| 606 | | 606 | |
| ... | @@ -620,7 +620,7 @@ pub fn formatFloatScientific( | ... | @@ -620,7 +620,7 @@ pub fn formatFloatScientific( |
| 620 | options: FormatOptions, | 620 | options: FormatOptions, |
| 621 | context: var, | 621 | context: var, |
| 622 | comptime Errors: type, | 622 | comptime Errors: type, |
| 623 | output: fn (@TypeOf(context), []const u8) Errors!void, | 623 | comptime output: fn (@TypeOf(context), []const u8) Errors!void, |
| 624 | ) Errors!void { | 624 | ) Errors!void { |
| 625 | var x = @floatCast(f64, value); | 625 | var x = @floatCast(f64, value); |
| 626 | | 626 | |
| ... | @@ -715,7 +715,7 @@ pub fn formatFloatDecimal( | ... | @@ -715,7 +715,7 @@ pub fn formatFloatDecimal( |
| 715 | options: FormatOptions, | 715 | options: FormatOptions, |
| 716 | context: var, | 716 | context: var, |
| 717 | comptime Errors: type, | 717 | comptime Errors: type, |
| 718 | output: fn (@TypeOf(context), []const u8) Errors!void, | 718 | comptime output: fn (@TypeOf(context), []const u8) Errors!void, |
| 719 | ) Errors!void { | 719 | ) Errors!void { |
| 720 | var x = @as(f64, value); | 720 | var x = @as(f64, value); |
| 721 | | 721 | |
| ... | @@ -861,7 +861,7 @@ pub fn formatBytes( | ... | @@ -861,7 +861,7 @@ pub fn formatBytes( |
| 861 | comptime radix: usize, | 861 | comptime radix: usize, |
| 862 | context: var, | 862 | context: var, |
| 863 | comptime Errors: type, | 863 | comptime Errors: type, |
| 864 | output: fn (@TypeOf(context), []const u8) Errors!void, | 864 | comptime output: fn (@TypeOf(context), []const u8) Errors!void, |
| 865 | ) Errors!void { | 865 | ) Errors!void { |
| 866 | if (value == 0) { | 866 | if (value == 0) { |
| 867 | return output(context, "0B"); | 867 | return output(context, "0B"); |
| ... | @@ -902,7 +902,7 @@ pub fn formatInt( | ... | @@ -902,7 +902,7 @@ pub fn formatInt( |
| 902 | options: FormatOptions, | 902 | options: FormatOptions, |
| 903 | context: var, | 903 | context: var, |
| 904 | comptime Errors: type, | 904 | comptime Errors: type, |
| 905 | output: fn (@TypeOf(context), []const u8) Errors!void, | 905 | comptime output: fn (@TypeOf(context), []const u8) Errors!void, |
| 906 | ) Errors!void { | 906 | ) Errors!void { |
| 907 | const int_value = if (@TypeOf(value) == comptime_int) blk: { | 907 | const int_value = if (@TypeOf(value) == comptime_int) blk: { |
| 908 | const Int = math.IntFittingRange(value, value); | 908 | const Int = math.IntFittingRange(value, value); |
| ... | @@ -924,7 +924,7 @@ fn formatIntSigned( | ... | @@ -924,7 +924,7 @@ fn formatIntSigned( |
| 924 | options: FormatOptions, | 924 | options: FormatOptions, |
| 925 | context: var, | 925 | context: var, |
| 926 | comptime Errors: type, | 926 | comptime Errors: type, |
| 927 | output: fn (@TypeOf(context), []const u8) Errors!void, | 927 | comptime output: fn (@TypeOf(context), []const u8) Errors!void, |
| 928 | ) Errors!void { | 928 | ) Errors!void { |
| 929 | const new_options = FormatOptions{ | 929 | const new_options = FormatOptions{ |
| 930 | .width = if (options.width) |w| (if (w == 0) 0 else w - 1) else null, | 930 | .width = if (options.width) |w| (if (w == 0) 0 else w - 1) else null, |
| ... | @@ -955,7 +955,7 @@ fn formatIntUnsigned( | ... | @@ -955,7 +955,7 @@ fn formatIntUnsigned( |
| 955 | options: FormatOptions, | 955 | options: FormatOptions, |
| 956 | context: var, | 956 | context: var, |
| 957 | comptime Errors: type, | 957 | comptime Errors: type, |
| 958 | output: fn (@TypeOf(context), []const u8) Errors!void, | 958 | comptime output: fn (@TypeOf(context), []const u8) Errors!void, |
| 959 | ) Errors!void { | 959 | ) Errors!void { |
| 960 | assert(base >= 2); | 960 | assert(base >= 2); |
| 961 | var buf: [math.max(@TypeOf(value).bit_count, 1)]u8 = undefined; | 961 | var buf: [math.max(@TypeOf(value).bit_count, 1)]u8 = undefined; |
| ... | @@ -1419,7 +1419,7 @@ test "custom" { | ... | @@ -1419,7 +1419,7 @@ test "custom" { |
| 1419 | options: FormatOptions, | 1419 | options: FormatOptions, |
| 1420 | context: var, | 1420 | context: var, |
| 1421 | comptime Errors: type, | 1421 | comptime Errors: type, |
| 1422 | output: fn (@TypeOf(context), []const u8) Errors!void, | 1422 | comptime output: fn (@TypeOf(context), []const u8) Errors!void, |
| 1423 | ) Errors!void { | 1423 | ) Errors!void { |
| 1424 | if (fmt.len == 0 or comptime std.mem.eql(u8, fmt, "p")) { | 1424 | if (fmt.len == 0 or comptime std.mem.eql(u8, fmt, "p")) { |
| 1425 | return std.fmt.format(context, Errors, output, "({d:.3},{d:.3})", .{ self.x, self.y }); | 1425 | return std.fmt.format(context, Errors, output, "({d:.3},{d:.3})", .{ self.x, self.y }); |
| ... | @@ -1626,7 +1626,7 @@ test "formatType max_depth" { | ... | @@ -1626,7 +1626,7 @@ test "formatType max_depth" { |
| 1626 | options: FormatOptions, | 1626 | options: FormatOptions, |
| 1627 | context: var, | 1627 | context: var, |
| 1628 | comptime Errors: type, | 1628 | comptime Errors: type, |
| 1629 | output: fn (@TypeOf(context), []const u8) Errors!void, | 1629 | comptime output: fn (@TypeOf(context), []const u8) Errors!void, |
| 1630 | ) Errors!void { | 1630 | ) Errors!void { |
| 1631 | if (fmt.len == 0) { | 1631 | if (fmt.len == 0) { |
| 1632 | return std.fmt.format(context, Errors, output, "({d:.3},{d:.3})", .{ self.x, self.y }); | 1632 | return std.fmt.format(context, Errors, output, "({d:.3},{d:.3})", .{ self.x, self.y }); |