Allow printing optionals

This commit is contained in:
jaina heartles 2022-12-17 12:05:08 -08:00
parent af396a0cb6
commit 71a03b30f0

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});
}