diff --git a/lib/std/Io.zig b/lib/std/Io.zig index 971a720f25..c55c28f177 100644 --- a/lib/std/Io.zig +++ b/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"); } diff --git a/lib/std/Io/fixed_buffer_stream.zig b/lib/std/Io/fixed_buffer_stream.zig index 67d6f3d286..c284b9baf4 100644 --- a/lib/std/Io/fixed_buffer_stream.zig +++ b/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; diff --git a/lib/std/Io/seekable_stream.zig b/lib/std/Io/seekable_stream.zig deleted file mode 100644 index 1aa653dbe5..0000000000 --- a/lib/std/Io/seekable_stream.zig +++ /dev/null @@ -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); - } - }; -} diff --git a/lib/std/fs/File.zig b/lib/std/fs/File.zig index eca2d6667f..354d559d79 100644 --- a/lib/std/fs/File.zig +++ b/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.