Skip to content

Commit

Permalink
examples: Fix getty.serialize calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Phan committed Feb 3, 2023
1 parent fb6c551 commit 6ce75d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/bool-serializer/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ const Serializer = struct {
pub fn main() anyerror!void {
const s = (Serializer{}).serializer();

try getty.serialize(true, s);
try getty.serialize(false, s);
try getty.serialize(null, true, s);
try getty.serialize(null, false, s);
}
14 changes: 7 additions & 7 deletions examples/seq-serializer/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const Serializer = struct {
false => std.debug.print(", ", .{}),
}

try getty.serialize(value, (Serializer{}).serializer());
try getty.serialize(null, value, (Serializer{}).serializer());
}

fn end(_: *Seq) Error!Ok {
Expand All @@ -63,18 +63,18 @@ pub fn main() anyerror!void {
const s = (Serializer{}).serializer();

// Primitives
try getty.serialize(.{ true, false }, s);
try getty.serialize([_]bool{ true, false }, s);
try getty.serialize(&&&[_]bool{ true, false }, s);
try getty.serialize(@Vector(2, bool){ true, false }, s);
try getty.serialize(null, .{ true, false }, s);
try getty.serialize(null, [_]bool{ true, false }, s);
try getty.serialize(null, &&&[_]bool{ true, false }, s);
try getty.serialize(null, @Vector(2, bool){ true, false }, s);

// std.ArrayList
var list = std.ArrayList(bool).init(allocator);
defer list.deinit();
try list.appendSlice(&.{ true, false });
try getty.serialize(list, s);
try getty.serialize(null, list, s);

// std.BoundedArray
var arr = try std.BoundedArray(bool, 2).fromSlice(&.{ true, false });
try getty.serialize(arr, s);
try getty.serialize(null, arr, s);
}

0 comments on commit 6ce75d7

Please sign in to comment.