fix: update Buffer.get_line function for zig-0.15
This commit is contained in:
parent
0f560ed3bc
commit
2867fc9a8e
1 changed files with 3 additions and 3 deletions
|
@ -751,12 +751,12 @@ const Node = union(enum) {
|
||||||
return Node.new(allocator, try merge_in_place(leaves[0..mid], allocator), try merge_in_place(leaves[mid..], allocator));
|
return Node.new(allocator, try merge_in_place(leaves[0..mid], allocator), try merge_in_place(leaves[mid..], allocator));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_line(self: *const Node, line: usize, result: *ArrayList(u8), metrics: Metrics) !void {
|
pub fn get_line(self: *const Node, line: usize, result: *std.Io.Writer, metrics: Metrics) !void {
|
||||||
const Ctx = struct {
|
const Ctx = struct {
|
||||||
line: *ArrayList(u8),
|
line: *std.Io.Writer,
|
||||||
fn walker(ctx_: *anyopaque, leaf: *const Leaf, _: Metrics) Walker {
|
fn walker(ctx_: *anyopaque, leaf: *const Leaf, _: Metrics) Walker {
|
||||||
const ctx = @as(*@This(), @ptrCast(@alignCast(ctx_)));
|
const ctx = @as(*@This(), @ptrCast(@alignCast(ctx_)));
|
||||||
ctx.line.appendSlice(leaf.buf) catch |e| return .{ .err = e };
|
ctx.line.writeAll(leaf.buf) catch |e| return .{ .err = e };
|
||||||
return if (!leaf.eol) Walker.keep_walking else Walker.stop;
|
return if (!leaf.eol) Walker.keep_walking else Walker.stop;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue