Allow printing optionals
This commit is contained in:
parent
af396a0cb6
commit
71a03b30f0
1 changed files with 1 additions and 0 deletions
|
@ -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});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue