Fixed error types for GetSeekPosError

This commit is contained in:
Edward Dean 2021-04-04 10:34:34 +01:00 committed by Andrew Kelley
parent 7302b096bd
commit 83a2665772
2 changed files with 5 additions and 6 deletions

View File

@ -223,15 +223,15 @@ pub const File = struct {
return os.lseek_SET(self.handle, offset);
}
pub const GetPosError = os.SeekError || os.FStatError;
pub const GetSeekPosError = os.SeekError || os.FStatError;
/// TODO: integrate with async I/O
pub fn getPos(self: File) GetPosError!u64 {
pub fn getPos(self: File) GetSeekPosError!u64 {
return os.lseek_CUR_get(self.handle);
}
/// TODO: integrate with async I/O
pub fn getEndPos(self: File) GetPosError!u64 {
pub fn getEndPos(self: File) GetSeekPosError!u64 {
if (builtin.os.tag == .windows) {
return windows.GetFileSizeEx(self.handle);
}
@ -819,7 +819,7 @@ pub const File = struct {
pub const SeekableStream = io.SeekableStream(
File,
SeekError,
GetPosError,
GetSeekPosError,
seekTo,
seekBy,
getPos,

View File

@ -5,7 +5,6 @@
// and substantial portions of the software.
const std = @import("../std.zig");
const io = std.io;
const testing = std.testing;
/// Provides `io.Reader`, `io.Writer`, and `io.SeekableStream` for in-memory buffers as
/// well as files.
@ -19,7 +18,7 @@ pub const StreamSource = union(enum) {
pub const ReadError = std.fs.File.ReadError;
pub const WriteError = std.fs.File.WriteError;
pub const SeekError = std.fs.File.SeekError;
pub const GetSeekPosError = std.fs.File.GetPosError;
pub const GetSeekPosError = std.fs.File.GetSeekPosError;
pub const Reader = io.Reader(*StreamSource, ReadError, read);
pub const Writer = io.Writer(*StreamSource, WriteError, write);