authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-08-04 13:39:53 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-08-04 13:39:53 -07:00
log5fc8936866ce781c435d191c986d7c185072dc4f
tree8dceaf4676565d0c71789ed479cbf7ef391bb422
parent8628846c832086d97f28c54eab157cda389c319a

add joinPartial


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 {
642642 }
643643 return temp;
644644}
645
646pub 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}