Change FileAccess wrapper functions to pass by value
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kayomn 2022-10-19 00:02:23 +01:00
parent 1cc19d41da
commit 3a23f5feca
1 changed files with 7 additions and 7 deletions

View File

@ -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 /// Freeing an invalid `file_access` has no effect on the file and logs a warning over the
/// wasted effort. /// wasted effort.
/// ///
pub fn close(file_access: *FileAccess) void { pub fn close(file_access: FileAccess) void {
return file_access.implementation.close(file_access.context); 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 /// Returns the number of bytes into the file that the cursor is relative to its beginning or a
/// [Error] on failure. /// [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); 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 /// Returns the current length of the file at the time of the operation or a [Error] if the file
/// failed to be queried. /// 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); 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. /// 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); return file_access.implementation.read(file_access.context, buffer);
} }
@ -74,7 +74,7 @@ pub const FileAccess = struct {
/// ///
/// Returns [Error] on failure. /// 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); return file_access.implementation.seek(file_access.context, cursor);
} }
@ -83,7 +83,7 @@ pub const FileAccess = struct {
/// ///
/// Returns [Error] on failure. /// 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); return file_access.implementation.seekToEnd(file_access.context);
} }
@ -92,7 +92,7 @@ pub const FileAccess = struct {
/// ///
/// Returns [Error] on failure; /// 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); return file_access.implementation.skip(file_access.context, offset);
} }
}; };