Allow printing optionals

This commit is contained in:
jaina heartles 2022-12-17 12:05:08 -08:00
parent af396a0cb6
commit 71a03b30f0
1 changed files with 1 additions and 0 deletions

View File

@ -210,6 +210,7 @@ fn print(writer: anytype, arg: anytype) !void {
if (T == void) return;
if (comptime std.meta.trait.isZigString(T)) return htmlEscape(writer, arg);
if (comptime std.meta.trait.isNumber(T)) return std.fmt.format(writer, "{}", .{arg});
if (comptime std.meta.trait.is(.Optional)(T)) return if (arg) |a| try print(writer, a);
try std.fmt.format(writer, "{}", .{arg});
}