refactor(utils): use new Io
This commit is contained in:
@@ -115,11 +115,11 @@ test "getLongestAsciiArtRowLen" {
|
|||||||
try std.testing.expectEqual(40, try getLongestAsciiArtRowLen(rows[0..]));
|
try std.testing.expectEqual(40, try getLongestAsciiArtRowLen(rows[0..]));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn readFile(allocator: std.mem.Allocator, file: std.fs.File, size: usize) ![]const u8 {
|
pub fn readFile(allocator: std.mem.Allocator, io: std.Io, file: std.Io.File, size: usize) ![]const u8 {
|
||||||
var file_buf = try allocator.alloc(u8, size);
|
var file_buf = try allocator.alloc(u8, size);
|
||||||
defer allocator.free(file_buf);
|
defer allocator.free(file_buf);
|
||||||
|
|
||||||
const read = try file.read(file_buf);
|
const read = try file.readPositionalAll(io, file_buf, 0);
|
||||||
|
|
||||||
const data = file_buf[0..read];
|
const data = file_buf[0..read];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user