We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4d293d6 commit d575ecfCopy full SHA for d575ecf
src/parse.zig
@@ -38,15 +38,19 @@ pub fn ArrayBackedSlice(
38
raw: []u8,
39
i: *usize,
40
41
- pub fn writeAll(self: *const @This(), in: []const u8) !void {
+ pub const Error = error{
42
+ OutOfMemory,
43
+ };
44
+
45
+ pub fn writeAll(self: *const @This(), in: []const u8) Error!void {
46
if (self.raw.len - self.i.* < in.len) {
47
return error.OutOfMemory;
48
}
49
@memcpy(self.raw[self.i.* .. self.i.* + in.len], in);
50
self.i.* += in.len;
51
52
- pub fn writeByte(self: *const @This(), in: u8) !void {
53
+ pub fn writeByte(self: *const @This(), in: u8) Error!void {
54
if (self.i.* >= self.raw.len) {
55
56
0 commit comments