diff options
| author | Jimmi Holst Christensen <jimmiholstchristensen@gmail.com> | 2018-10-15 09:51:15 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-15 09:51:15 -0400 |
| commit | 378d3e44034e817093966ea42c2940d6a0482dd8 (patch) | |
| tree | fe5f454097e1627b1afc65aebfb815dd70a7576d /std/rb.zig | |
| parent | 822d4fa216ea8f598e4a9d53161800494f449a94 (diff) | |
| download | zig-378d3e44034e817093966ea42c2940d6a0482dd8.tar.gz zig-378d3e44034e817093966ea42c2940d6a0482dd8.zip | |
Solve the return type ambiguity (#1628)
Changed container and initializer syntax
* <container> { ... } -> <container> . { ... }
* <exrp> { ... } -> <expr> . { ...}
Diffstat (limited to 'std/rb.zig')
| -rw-r--r-- | std/rb.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/std/rb.zig b/std/rb.zig index e42efc32af..ed37515227 100644 --- a/std/rb.zig +++ b/std/rb.zig @@ -2,14 +2,14 @@ const std = @import("index.zig"); const assert = std.debug.assert; const mem = std.mem; // For mem.Compare -const Color = enum(u1) { +const Color = enum(u1).{ Black, Red, }; const Red = Color.Red; const Black = Color.Black; -const ReplaceError = error{NotEqual}; +const ReplaceError = error.{NotEqual}; /// Insert this into your struct that you want to add to a red-black tree. /// Do not use a pointer. Turn the *rb.Node results of the functions in rb @@ -22,7 +22,7 @@ const ReplaceError = error{NotEqual}; /// fn number(node: *rb.Node) Number { /// return @fieldParentPtr(Number, "node", node); /// } -pub const Node = struct { +pub const Node = struct.{ left: ?*Node, right: ?*Node, @@ -128,7 +128,7 @@ pub const Node = struct { } }; -pub const Tree = struct { +pub const Tree = struct.{ root: ?*Node, compareFn: fn (*Node, *Node) mem.Compare, @@ -482,7 +482,7 @@ fn do_lookup(key: *Node, tree: *Tree, pparent: *?*Node, is_left: *bool) ?*Node { return null; } -const testNumber = struct { +const testNumber = struct.{ node: Node, value: usize, }; |
