mirror of
https://github.com/ziglang/zig.git
synced 2024-12-04 02:48:50 +00:00
Fixed error types for GetSeekPosError
This commit is contained in:
parent
7302b096bd
commit
83a2665772
@ -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,
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user