Commit f3a38e30fa

Andrew Kelley <andrew@ziglang.org>
2025-07-29 07:19:03
std.Io: delete SeekableStream
Alternative is to use File.Reader and File.Writer directly.
1 parent 4741a16
lib/std/fs/File.zig
@@ -1105,22 +1105,6 @@ pub fn deprecatedWriter(file: File) DeprecatedWriter {
     return .{ .context = file };
 }
 
-/// Deprecated in favor of `Reader` and `Writer`.
-pub const SeekableStream = io.SeekableStream(
-    File,
-    SeekError,
-    GetSeekPosError,
-    seekTo,
-    seekBy,
-    getPos,
-    getEndPos,
-);
-
-/// Deprecated in favor of `Reader` and `Writer`.
-pub fn seekableStream(file: File) SeekableStream {
-    return .{ .context = file };
-}
-
 /// Memoizes key information about a file handle such as:
 /// * The size from calling stat, or the error that occurred therein.
 /// * The current seek position.
lib/std/Io/fixed_buffer_stream.zig
@@ -4,8 +4,7 @@ const testing = std.testing;
 const mem = std.mem;
 const assert = std.debug.assert;
 
-/// This turns a byte buffer into an `io.GenericWriter`, `io.GenericReader`, or `io.SeekableStream`.
-/// If the supplied byte buffer is const, then `io.GenericWriter` is not available.
+/// Deprecated in favor of `std.Io.Reader.fixed` and `std.Io.Writer.fixed`.
 pub fn FixedBufferStream(comptime Buffer: type) type {
     return struct {
         /// `Buffer` is either a `[]u8` or `[]const u8`.
@@ -20,16 +19,6 @@ pub fn FixedBufferStream(comptime Buffer: type) type {
         pub const Reader = io.GenericReader(*Self, ReadError, read);
         pub const Writer = io.GenericWriter(*Self, WriteError, write);
 
-        pub const SeekableStream = io.SeekableStream(
-            *Self,
-            SeekError,
-            GetSeekPosError,
-            seekTo,
-            seekBy,
-            getPos,
-            getEndPos,
-        );
-
         const Self = @This();
 
         pub fn reader(self: *Self) Reader {
@@ -40,10 +29,6 @@ pub fn FixedBufferStream(comptime Buffer: type) type {
             return .{ .context = self };
         }
 
-        pub fn seekableStream(self: *Self) SeekableStream {
-            return .{ .context = self };
-        }
-
         pub fn read(self: *Self, dest: []u8) ReadError!usize {
             const size = @min(dest.len, self.buffer.len - self.pos);
             const end = self.pos + size;
lib/std/Io/seekable_stream.zig
@@ -1,35 +0,0 @@
-const std = @import("../std.zig");
-
-pub fn SeekableStream(
-    comptime Context: type,
-    comptime SeekErrorType: type,
-    comptime GetSeekPosErrorType: type,
-    comptime seekToFn: fn (context: Context, pos: u64) SeekErrorType!void,
-    comptime seekByFn: fn (context: Context, pos: i64) SeekErrorType!void,
-    comptime getPosFn: fn (context: Context) GetSeekPosErrorType!u64,
-    comptime getEndPosFn: fn (context: Context) GetSeekPosErrorType!u64,
-) type {
-    return struct {
-        context: Context,
-
-        const Self = @This();
-        pub const SeekError = SeekErrorType;
-        pub const GetSeekPosError = GetSeekPosErrorType;
-
-        pub fn seekTo(self: Self, pos: u64) SeekError!void {
-            return seekToFn(self.context, pos);
-        }
-
-        pub fn seekBy(self: Self, amt: i64) SeekError!void {
-            return seekByFn(self.context, amt);
-        }
-
-        pub fn getEndPos(self: Self) GetSeekPosError!u64 {
-            return getEndPosFn(self.context);
-        }
-
-        pub fn getPos(self: Self) GetSeekPosError!u64 {
-            return getPosFn(self.context);
-        }
-    };
-}
lib/std/Io.zig
@@ -438,8 +438,6 @@ pub fn GenericWriter(
 pub const AnyReader = @import("Io/DeprecatedReader.zig");
 /// Deprecated in favor of `Writer`.
 pub const AnyWriter = @import("Io/DeprecatedWriter.zig");
-/// Deprecated in favor of `File.Reader` and `File.Writer`.
-pub const SeekableStream = @import("Io/seekable_stream.zig").SeekableStream;
 /// Deprecated in favor of `Writer`.
 pub const BufferedWriter = @import("Io/buffered_writer.zig").BufferedWriter;
 /// Deprecated in favor of `Writer`.
@@ -948,7 +946,6 @@ test {
     _ = CountingWriter;
     _ = CountingReader;
     _ = FixedBufferStream;
-    _ = SeekableStream;
     _ = tty;
     _ = @import("Io/test.zig");
 }