Exercise to learn more about rust's type system. If you know a way to implement a trait on all itertors please tell me.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const StructField = std.builtin.Type.StructField; | |
fn Partial(comptime inner: type) type { | |
var typeInfo = @typeInfo(inner); | |
switch (typeInfo) { | |
.@"struct" => |*structure| { | |
var fields: []const StructField = &[0]StructField{}; | |
for (structure.fields) |field| { |