From 3a23f5feca34594847e1501d4972a637eb6d5ea7 Mon Sep 17 00:00:00 2001 From: kayomn Date: Wed, 19 Oct 2022 00:02:23 +0100 Subject: [PATCH] Change FileAccess wrapper functions to pass by value --- src/ona/io.zig | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ona/io.zig b/src/ona/io.zig index ca74716..83a7de3 100644 --- a/src/ona/io.zig +++ b/src/ona/io.zig @@ -36,7 +36,7 @@ pub const FileAccess = struct { /// Freeing an invalid `file_access` has no effect on the file and logs a warning over the /// wasted effort. /// - pub fn close(file_access: *FileAccess) void { + pub fn close(file_access: FileAccess) void { return file_access.implementation.close(file_access.context); } @@ -46,7 +46,7 @@ pub const FileAccess = struct { /// Returns the number of bytes into the file that the cursor is relative to its beginning or a /// [Error] on failure. /// - pub fn queryCursor(file_access: *FileAccess) Error!u64 { + pub fn queryCursor(file_access: FileAccess) Error!u64 { return file_access.implementation.queryCursor(file_access.context); } @@ -56,7 +56,7 @@ pub const FileAccess = struct { /// Returns the current length of the file at the time of the operation or a [Error] if the file /// failed to be queried. /// - pub fn queryLength(file_access: *FileAccess) Error!u64 { + pub fn queryLength(file_access: FileAccess) Error!u64 { return file_access.implementation.queryLength(file_access.context); } @@ -65,7 +65,7 @@ pub const FileAccess = struct { /// /// Returns the number of bytes that were available to be read, otherwise an [Error] on failure. /// - pub fn read(file_access: *FileAccess, buffer: []u8) Error!usize { + pub fn read(file_access: FileAccess, buffer: []u8) Error!usize { return file_access.implementation.read(file_access.context, buffer); } @@ -74,7 +74,7 @@ pub const FileAccess = struct { /// /// Returns [Error] on failure. /// - pub fn seek(file_access: *FileAccess, cursor: u64) Error!void { + pub fn seek(file_access: FileAccess, cursor: u64) Error!void { return file_access.implementation.seek(file_access.context, cursor); } @@ -83,7 +83,7 @@ pub const FileAccess = struct { /// /// Returns [Error] on failure. /// - pub fn seekToEnd(file_access: *FileAccess) Error!void { + pub fn seekToEnd(file_access: FileAccess) Error!void { return file_access.implementation.seekToEnd(file_access.context); } @@ -92,7 +92,7 @@ pub const FileAccess = struct { /// /// Returns [Error] on failure; /// - pub fn skip(file_access: *FileAccess, offset: i64) Error!void { + pub fn skip(file_access: FileAccess, offset: i64) Error!void { return file_access.implementation.skip(file_access.context, offset); } };