44pub fn main () ! void {
55 var arena = std .heap .ArenaAllocator .init (std .heap .page_allocator );
66 defer arena .deinit ();
7-
87 const allocator = arena .allocator ();
98
9+ var threaded = Io .Threaded .init (allocator , .{});
10+ defer threaded .deinit ();
11+ const io = threaded .io ();
12+
1013 const args = try std .process .argsAlloc (allocator );
1114 if (args .len != 4 ) @panic ("Wrong number of arguments" );
1215
@@ -15,23 +18,23 @@ pub fn main() !void {
1518 const output_path = args [3 ];
1619
1720 const patch_file = patch_file : {
18- const patch_file = try std . fs .cwd ().openFile (patch_file_path , .{ .mode = .read_only });
19- defer patch_file .close ();
21+ const patch_file = try Io . Dir .cwd ().openFile (io , patch_file_path , .{ .mode = .read_only });
22+ defer patch_file .close (io );
2023 var buf : [4096 ]u8 = undefined ;
21- var reader = patch_file .reader (& buf );
24+ var reader = patch_file .reader (io , & buf );
2225 break :patch_file try reader .interface .allocRemaining (allocator , .unlimited );
2326 };
2427 const chunk_details = Chunk .init (allocator , patch_file , 0 ) orelse @panic ("No chunk data found" );
2528
26- const file = try std . fs .cwd ().openFile (file_path , .{ .mode = .read_only });
27- defer file .close ();
29+ const file = try Io . Dir .cwd ().openFile (io , file_path , .{ .mode = .read_only });
30+ defer file .close (io );
2831 var in_buf : [4096 ]u8 = undefined ;
29- var reader = file .reader (& in_buf );
32+ var reader = file .reader (io , & in_buf );
3033
31- const output = try std . fs .cwd ().createFile (output_path , .{});
32- defer output .close ();
34+ const output = try Io . Dir .cwd ().createFile (io , output_path , .{});
35+ defer output .close (io );
3336 var out_buf : [4096 ]u8 = undefined ;
34- var writer = output .writer (& out_buf );
37+ var writer = output .writer (io , & out_buf );
3538
3639 var state : State = .copy ;
3740
@@ -134,4 +137,5 @@ const Chunk = struct {
134137
135138const std = @import ("std" );
136139const Allocator = std .mem .Allocator ;
137- const File = std .fs .File ;
140+ const Io = std .Io ;
141+ const File = Io .File ;
0 commit comments