authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-08-19 04:12:11-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2021-08-19 14:12:11+03:00
log7e7d67d8eed45bcf3908edd2f4ca864144fffad5
tree571923632ce1e968020448a5385581ecd1037a77
parentd785dc49aa6fc422d936928e504e50a63fa37759
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

std.fmt: add support for printing slices strings (#9562)


1 files changed, 7 insertions(+), 0 deletions(-)

lib/std/fmt.zig+7
......@@ -544,6 +544,13 @@ pub fn formatType(
544544 return formatText(value, actual_fmt, options, writer);
545545 }
546546 }
547 if (comptime std.meta.trait.isZigString(info.child)) {
548 for (value) |item, i| {
549 if (i != 0) try formatText(", ", actual_fmt, options, writer);
550 try formatText(item, actual_fmt, options, writer);
551 }
552 return;
553 }
547554 @compileError("Unknown format string: '" ++ actual_fmt ++ "' for type '" ++ @typeName(T) ++ "'");
548555 },
549556 .Enum, .Union, .Struct => {