| author | |
| committer | |
| log | 5fc8936866ce781c435d191c986d7c185072dc4f |
| tree | 8dceaf4676565d0c71789ed479cbf7ef391bb422 |
| parent | 8628846c832086d97f28c54eab157cda389c319a |
1 files changed, 8 insertions(+), 0 deletions(-)
src/lib.zig+8| ... | @@ -642,3 +642,11 @@ pub fn coalescePartial(comptime T: type, into: T, from: Partial(T)) T { | ... | @@ -642,3 +642,11 @@ pub fn coalescePartial(comptime T: type, into: T, from: Partial(T)) T { |
| 642 | } | 642 | } |
| 643 | return temp; | 643 | return temp; |
| 644 | } | 644 | } |
| 645 | |||
| 646 | pub fn joinPartial(comptime P: type, a: P, b: P) P { | ||
| 647 | var temp = a; | ||
| 648 | inline for (comptime std.meta.fieldNames(P)) |name| { | ||
| 649 | if (@field(b, name)) |val| @field(temp, name) = val; | ||
| 650 | } | ||
| 651 | return temp; | ||
| 652 | } |