There’s a small “hack” you can use in these situations as well. You simply break from the block instead of continuing the loop. This will jump you straight to the next unrolled block of the inline for loop at runtime and works effectively as a continue.
Example from your original code:
fn decodeUnion(comptime T: type, fbs: *FBS) !T {
const starting_position = try fbs.getPos();
inline for (comptime std.meta.fields(T)) |union_field| inlineCont: {
const res = decodeFbs(union_field.type, fbs) catch |err| switch (err) {
error.Invalid, error.EndOfStream => {
try fbs.seekTo(starting_position);
break :inlineCont;
},
};
return res;
} else {
return error.Invalid;
}
unreachable;
}