| ... | @@ -181,6 +181,7 @@ pub fn writeStreamArbitraryDepth( | ... | @@ -181,6 +181,7 @@ pub fn writeStreamArbitraryDepth( |
| 181 | /// * If the union declares a method `pub fn jsonStringify(self: *@This(), jw: anytype) !void`, it is called to do the serialization instead of the default behavior. The given `jw` is a pointer to this `WriteStream`. | 181 | /// * If the union declares a method `pub fn jsonStringify(self: *@This(), jw: anytype) !void`, it is called to do the serialization instead of the default behavior. The given `jw` is a pointer to this `WriteStream`. |
| 182 | /// * Zig `enum` -> JSON string naming the active tag. | 182 | /// * Zig `enum` -> JSON string naming the active tag. |
| 183 | /// * If the enum declares a method `pub fn jsonStringify(self: *@This(), jw: anytype) !void`, it is called to do the serialization instead of the default behavior. The given `jw` is a pointer to this `WriteStream`. | 183 | /// * If the enum declares a method `pub fn jsonStringify(self: *@This(), jw: anytype) !void`, it is called to do the serialization instead of the default behavior. The given `jw` is a pointer to this `WriteStream`. |
| | 184 | /// * Zig untyped enum literal -> JSON string naming the active tag. |
| 184 | /// * Zig error -> JSON string naming the error. | 185 | /// * Zig error -> JSON string naming the error. |
| 185 | /// * Zig `*T` -> the rendering of `T`. Note there is no guard against circular-reference infinite recursion. | 186 | /// * Zig `*T` -> the rendering of `T`. Note there is no guard against circular-reference infinite recursion. |
| 186 | /// | 187 | /// |
| ... | @@ -449,7 +450,7 @@ pub fn WriteStream( | ... | @@ -449,7 +450,7 @@ pub fn WriteStream( |
| 449 | return try self.write(null); | 450 | return try self.write(null); |
| 450 | } | 451 | } |
| 451 | }, | 452 | }, |
| 452 | .Enum => { | 453 | .Enum, .EnumLiteral => { |
| 453 | if (comptime std.meta.trait.hasFn("jsonStringify")(T)) { | 454 | if (comptime std.meta.trait.hasFn("jsonStringify")(T)) { |
| 454 | return value.jsonStringify(self); | 455 | return value.jsonStringify(self); |
| 455 | } | 456 | } |