pub fn takeEnumNonexhaustive(r: *Reader, comptime Enum: type, endian: std.builtin.Endian) Error!Enum ReadFailedSee the Reader implementation for detailed diagnostics.
EndOfStream1282
1283
1284
1285
1286
1287
1288
1289
1290pub fn takeEnumNonexhaustive(r: *Reader, comptime Enum: type, endian: std.builtin.Endian) Error!Enum {
const info = @typeInfo(Enum).@"enum";
comptime assert(info.mode != .exhaustive);
comptime assert(@bitSizeOf(info.tag_type) == @sizeOf(info.tag_type) * 8);
return takeEnum(r, Enum, endian) catch |err| switch (err) {
error.InvalidEnumTag => unreachable,
else => |e| return e,
};
}
Reads an integer with the same size as the given nonexhaustive enum's tag type.
Asserts the buffer was initialized with a capacity at least
@sizeOf(Enum).