| ... | @@ -301,6 +301,10 @@ pub fn writeEnumBig(writer: anytype, comptime E: type, value: E) !void { | ... | @@ -301,6 +301,10 @@ pub fn writeEnumBig(writer: anytype, comptime E: type, value: E) !void { |
| 301 | try writer.writeIntBig(@typeInfo(E).Enum.tag_type, @enumToInt(value)); | 301 | try writer.writeIntBig(@typeInfo(E).Enum.tag_type, @enumToInt(value)); |
| 302 | } | 302 | } |
| 303 | | 303 | |
| | 304 | pub fn readEnumBig(reader: anytype, comptime E: type) !E { |
| | 305 | return @intToEnum(E, try reader.readIntBig(@typeInfo(E).Enum.tag_type)); |
| | 306 | } |
| | 307 | |
| 304 | pub fn readExpected(reader: anytype, expected: []const u8) !bool { | 308 | pub fn readExpected(reader: anytype, expected: []const u8) !bool { |
| 305 | for (expected) |item, i| { | 309 | for (expected) |item, i| { |
| 306 | const actual = try reader.readByte(); | 310 | const actual = try reader.readByte(); |