| ... | @@ -680,3 +680,12 @@ pub fn ReverseFields(comptime T: type) type { | ... | @@ -680,3 +680,12 @@ pub fn ReverseFields(comptime T: type) type { |
| 680 | pub fn stringToEnum(comptime E: type, str: ?string) ?E { | 680 | pub fn stringToEnum(comptime E: type, str: ?string) ?E { |
| 681 | return std.meta.stringToEnum(E, str orelse return null); | 681 | return std.meta.stringToEnum(E, str orelse return null); |
| 682 | } | 682 | } |
| | 683 | |
| | 684 | pub fn containsAggregate(comptime T: type, haystack: []const T, needle: T) bool { |
| | 685 | for (haystack) |item| { |
| | 686 | if (T.eql(item, needle)) { |
| | 687 | return true; |
| | 688 | } |
| | 689 | } |
| | 690 | return false; |
| | 691 | } |