| ... | @@ -9,11 +9,7 @@ const meta = @import("../meta.zig"); | ... | @@ -9,11 +9,7 @@ const meta = @import("../meta.zig"); |
| 9 | | 9 | |
| 10 | pub const TraitFn = fn (type) bool; | 10 | pub const TraitFn = fn (type) bool; |
| 11 | | 11 | |
| 12 | //////Trait generators | 12 | pub fn multiTrait(comptime traits: var) TraitFn { |
| 13 | | | |
| 14 | // TODO convert to tuples when #4335 is done | | |
| 15 | pub const TraitList = []const TraitFn; | | |
| 16 | pub fn multiTrait(comptime traits: TraitList) TraitFn { | | |
| 17 | const Closure = struct { | 13 | const Closure = struct { |
| 18 | pub fn trait(comptime T: type) bool { | 14 | pub fn trait(comptime T: type) bool { |
| 19 | inline for (traits) |t| | 15 | inline for (traits) |t| |
| ... | @@ -39,7 +35,7 @@ test "std.meta.trait.multiTrait" { | ... | @@ -39,7 +35,7 @@ test "std.meta.trait.multiTrait" { |
| 39 | } | 35 | } |
| 40 | }; | 36 | }; |
| 41 | | 37 | |
| 42 | const isVector = multiTrait(&[_]TraitFn{ | 38 | const isVector = multiTrait(.{ |
| 43 | hasFn("add"), | 39 | hasFn("add"), |
| 44 | hasField("x"), | 40 | hasField("x"), |
| 45 | hasField("y"), | 41 | hasField("y"), |