| ... | ... | @@ -495,6 +495,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions, |
| 495 | 495 | } else { |
| 496 | 496 | try format(writer, "@{x}", .{@intFromPtr(&value)}); |
| 497 | 497 | } |
| 498 | return; |
| 498 | 499 | }, |
| 499 | 500 | .@"struct" => |info| { |
| 500 | 501 | if (actual_fmt.len != 0) invalidFmtError(fmt, value); |
| ... | ... | @@ -530,6 +531,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions, |
| 530 | 531 | try formatType(@field(value, f.name), "any", options, writer, max_depth - 1); |
| 531 | 532 | } |
| 532 | 533 | try writer.writeAll(" }"); |
| 534 | return; |
| 533 | 535 | }, |
| 534 | 536 | .pointer => |ptr_info| switch (ptr_info.size) { |
| 535 | 537 | .one => switch (@typeInfo(ptr_info.child)) { |
| ... | ... | @@ -547,7 +549,6 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions, |
| 547 | 549 | if (actual_fmt[0] == 's' and ptr_info.child == u8) { |
| 548 | 550 | return formatBuf(std.mem.span(value), options, writer); |
| 549 | 551 | } |
| 550 | | invalidFmtError(fmt, value); |
| 551 | 552 | }, |
| 552 | 553 | .slice => { |
| 553 | 554 | if (actual_fmt.len == 0) { |
| ... | ... | @@ -567,6 +568,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions, |
| 567 | 568 | } |
| 568 | 569 | } |
| 569 | 570 | try writer.writeAll(" }"); |
| 571 | return; |
| 570 | 572 | }, |
| 571 | 573 | }, |
| 572 | 574 | .array => |info| { |
| ... | ... | @@ -587,6 +589,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions, |
| 587 | 589 | } |
| 588 | 590 | } |
| 589 | 591 | try writer.writeAll(" }"); |
| 592 | return; |
| 590 | 593 | }, |
| 591 | 594 | .vector => |info| { |
| 592 | 595 | if (max_depth == 0) { |
| ... | ... | @@ -601,6 +604,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions, |
| 601 | 604 | } |
| 602 | 605 | } |
| 603 | 606 | try writer.writeAll(" }"); |
| 607 | return; |
| 604 | 608 | }, |
| 605 | 609 | .@"fn" => @compileError("unable to format function body type, use '*const " ++ @typeName(T) ++ "' for a function pointer type"), |
| 606 | 610 | .type => { |