diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-01-09 13:04:08 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-09 13:04:08 -0800 |
| commit | 29928af6005997d2b02b4c3a3576a696a02fa269 (patch) | |
| tree | 9852e606adc5bc065e758482445bb6d1c5ead99c /lib/std/io | |
| parent | a0ad2dee6a0b3bb7fd04032f6113206f7b4e73eb (diff) | |
| parent | e72472d953f5e91d37bc5f1bf1ec7b6fb5b1afe2 (diff) | |
| download | zig-29928af6005997d2b02b4c3a3576a696a02fa269.tar.gz zig-29928af6005997d2b02b4c3a3576a696a02fa269.zip | |
Merge pull request #7729 from jayschwa/remove-deprecated-stream
Remove deprecated stream aliases
Diffstat (limited to 'lib/std/io')
| -rw-r--r-- | lib/std/io/bit_in_stream.zig | 10 | ||||
| -rw-r--r-- | lib/std/io/bit_out_stream.zig | 10 | ||||
| -rw-r--r-- | lib/std/io/bit_reader.zig | 7 | ||||
| -rw-r--r-- | lib/std/io/bit_writer.zig | 6 | ||||
| -rw-r--r-- | lib/std/io/buffered_atomic_file.zig | 22 | ||||
| -rw-r--r-- | lib/std/io/buffered_in_stream.zig | 10 | ||||
| -rw-r--r-- | lib/std/io/buffered_out_stream.zig | 10 | ||||
| -rw-r--r-- | lib/std/io/buffered_reader.zig | 7 | ||||
| -rw-r--r-- | lib/std/io/buffered_writer.zig | 7 | ||||
| -rw-r--r-- | lib/std/io/c_out_stream.zig | 10 | ||||
| -rw-r--r-- | lib/std/io/counting_out_stream.zig | 10 | ||||
| -rw-r--r-- | lib/std/io/counting_writer.zig | 7 | ||||
| -rw-r--r-- | lib/std/io/find_byte_writer.zig (renamed from lib/std/io/find_byte_out_stream.zig) | 8 | ||||
| -rw-r--r-- | lib/std/io/fixed_buffer_stream.zig | 14 | ||||
| -rw-r--r-- | lib/std/io/in_stream.zig | 7 | ||||
| -rw-r--r-- | lib/std/io/multi_out_stream.zig | 10 | ||||
| -rw-r--r-- | lib/std/io/multi_writer.zig | 7 | ||||
| -rw-r--r-- | lib/std/io/out_stream.zig | 7 | ||||
| -rw-r--r-- | lib/std/io/peek_stream.zig | 17 | ||||
| -rw-r--r-- | lib/std/io/stream_source.zig | 16 |
20 files changed, 21 insertions, 181 deletions
diff --git a/lib/std/io/bit_in_stream.zig b/lib/std/io/bit_in_stream.zig deleted file mode 100644 index 8bf3d6137a..0000000000 --- a/lib/std/io/bit_in_stream.zig +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2015-2021 Zig Contributors -// This file is part of [zig](https://ziglang.org/), which is MIT licensed. -// The MIT license requires this copyright notice to be included in all copies -// and substantial portions of the software. -/// Deprecated: use `std.io.bit_reader.BitReader` -pub const BitInStream = @import("./bit_reader.zig").BitReader; - -/// Deprecated: use `std.io.bit_reader.bitReader` -pub const bitInStream = @import("./bit_reader.zig").bitReader; diff --git a/lib/std/io/bit_out_stream.zig b/lib/std/io/bit_out_stream.zig deleted file mode 100644 index e75da9b2de..0000000000 --- a/lib/std/io/bit_out_stream.zig +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2015-2021 Zig Contributors -// This file is part of [zig](https://ziglang.org/), which is MIT licensed. -// The MIT license requires this copyright notice to be included in all copies -// and substantial portions of the software. -/// Deprecated: use `std.io.bit_writer.BitWriter` -pub const BitOutStream = @import("./bit_writer.zig").BitWriter; - -/// Deprecated: use `std.io.bit_writer.bitWriter` -pub const bitOutStream = @import("./bit_writer.zig").bitWriter; diff --git a/lib/std/io/bit_reader.zig b/lib/std/io/bit_reader.zig index b0a60e62c3..213cd2b503 100644 --- a/lib/std/io/bit_reader.zig +++ b/lib/std/io/bit_reader.zig @@ -21,8 +21,6 @@ pub fn BitReader(endian: builtin.Endian, comptime ReaderType: type) type { pub const Error = ReaderType.Error; pub const Reader = io.Reader(*Self, Error, read); - /// Deprecated: use `Reader` - pub const InStream = io.InStream(*Self, Error, read); const Self = @This(); const u8_bit_count = comptime meta.bitCount(u8); @@ -165,11 +163,6 @@ pub fn BitReader(endian: builtin.Endian, comptime ReaderType: type) type { pub fn reader(self: *Self) Reader { return .{ .context = self }; } - - /// Deprecated: use `reader` - pub fn inStream(self: *Self) InStream { - return .{ .context = self }; - } }; } diff --git a/lib/std/io/bit_writer.zig b/lib/std/io/bit_writer.zig index 651c1e149f..3ad2b75efb 100644 --- a/lib/std/io/bit_writer.zig +++ b/lib/std/io/bit_writer.zig @@ -21,8 +21,6 @@ pub fn BitWriter(endian: builtin.Endian, comptime WriterType: type) type { pub const Error = WriterType.Error; pub const Writer = io.Writer(*Self, Error, write); - /// Deprecated: use `Writer` - pub const OutStream = io.OutStream(*Self, Error, write); const Self = @This(); const u8_bit_count = comptime meta.bitCount(u8); @@ -141,10 +139,6 @@ pub fn BitWriter(endian: builtin.Endian, comptime WriterType: type) type { pub fn writer(self: *Self) Writer { return .{ .context = self }; } - /// Deprecated: use `writer` - pub fn outStream(self: *Self) OutStream { - return .{ .context = self }; - } }; } diff --git a/lib/std/io/buffered_atomic_file.zig b/lib/std/io/buffered_atomic_file.zig index 66c349d318..1aed190a47 100644 --- a/lib/std/io/buffered_atomic_file.zig +++ b/lib/std/io/buffered_atomic_file.zig @@ -10,13 +10,13 @@ const File = std.fs.File; pub const BufferedAtomicFile = struct { atomic_file: fs.AtomicFile, - file_stream: File.OutStream, - buffered_stream: BufferedOutStream, + file_writer: File.Writer, + buffered_writer: BufferedWriter, allocator: *mem.Allocator, pub const buffer_size = 4096; - pub const BufferedOutStream = std.io.BufferedOutStream(buffer_size, File.OutStream); - pub const OutStream = std.io.OutStream(*BufferedOutStream, BufferedOutStream.Error, BufferedOutStream.write); + pub const BufferedWriter = std.io.BufferedWriter(buffer_size, File.Writer); + pub const Writer = std.io.Writer(*BufferedWriter, BufferedWriter.Error, BufferedWriter.write); /// TODO when https://github.com/ziglang/zig/issues/2761 is solved /// this API will not need an allocator @@ -29,8 +29,8 @@ pub const BufferedAtomicFile = struct { var self = try allocator.create(BufferedAtomicFile); self.* = BufferedAtomicFile{ .atomic_file = undefined, - .file_stream = undefined, - .buffered_stream = undefined, + .file_writer = undefined, + .buffered_writer = undefined, .allocator = allocator, }; errdefer allocator.destroy(self); @@ -38,8 +38,8 @@ pub const BufferedAtomicFile = struct { self.atomic_file = try dir.atomicFile(dest_path, atomic_file_options); errdefer self.atomic_file.deinit(); - self.file_stream = self.atomic_file.file.writer(); - self.buffered_stream = .{ .unbuffered_writer = self.file_stream }; + self.file_writer = self.atomic_file.file.writer(); + self.buffered_writer = .{ .unbuffered_writer = self.file_writer }; return self; } @@ -50,11 +50,11 @@ pub const BufferedAtomicFile = struct { } pub fn finish(self: *BufferedAtomicFile) !void { - try self.buffered_stream.flush(); + try self.buffered_writer.flush(); try self.atomic_file.finish(); } - pub fn stream(self: *BufferedAtomicFile) OutStream { - return .{ .context = &self.buffered_stream }; + pub fn writer(self: *BufferedAtomicFile) Writer { + return .{ .context = &self.buffered_writer }; } }; diff --git a/lib/std/io/buffered_in_stream.zig b/lib/std/io/buffered_in_stream.zig deleted file mode 100644 index e24bd290c3..0000000000 --- a/lib/std/io/buffered_in_stream.zig +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2015-2021 Zig Contributors -// This file is part of [zig](https://ziglang.org/), which is MIT licensed. -// The MIT license requires this copyright notice to be included in all copies -// and substantial portions of the software. -/// Deprecated: use `std.io.buffered_reader.BufferedReader` -pub const BufferedInStream = @import("./buffered_reader.zig").BufferedReader; - -/// Deprecated: use `std.io.buffered_reader.bufferedReader` -pub const bufferedInStream = @import("./buffered_reader.zig").bufferedReader; diff --git a/lib/std/io/buffered_out_stream.zig b/lib/std/io/buffered_out_stream.zig deleted file mode 100644 index 0d4ac19873..0000000000 --- a/lib/std/io/buffered_out_stream.zig +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2015-2021 Zig Contributors -// This file is part of [zig](https://ziglang.org/), which is MIT licensed. -// The MIT license requires this copyright notice to be included in all copies -// and substantial portions of the software. -/// Deprecated: use `std.io.buffered_writer.BufferedWriter` -pub const BufferedOutStream = @import("./buffered_writer.zig").BufferedWriter; - -/// Deprecated: use `std.io.buffered_writer.bufferedWriter` -pub const bufferedOutStream = @import("./buffered_writer.zig").bufferedWriter; diff --git a/lib/std/io/buffered_reader.zig b/lib/std/io/buffered_reader.zig index ef99ba29a3..5fda7f2741 100644 --- a/lib/std/io/buffered_reader.zig +++ b/lib/std/io/buffered_reader.zig @@ -15,8 +15,6 @@ pub fn BufferedReader(comptime buffer_size: usize, comptime ReaderType: type) ty pub const Error = ReaderType.Error; pub const Reader = io.Reader(*Self, Error, read); - /// Deprecated: use `Reader` - pub const InStream = Reader; const Self = @This(); const FifoType = std.fifo.LinearFifo(u8, std.fifo.LinearFifoBufferType{ .Static = buffer_size }); @@ -45,11 +43,6 @@ pub fn BufferedReader(comptime buffer_size: usize, comptime ReaderType: type) ty pub fn reader(self: *Self) Reader { return .{ .context = self }; } - - /// Deprecated: use `reader` - pub fn inStream(self: *Self) InStream { - return .{ .context = self }; - } }; } diff --git a/lib/std/io/buffered_writer.zig b/lib/std/io/buffered_writer.zig index c0efe1acba..056ff08987 100644 --- a/lib/std/io/buffered_writer.zig +++ b/lib/std/io/buffered_writer.zig @@ -13,8 +13,6 @@ pub fn BufferedWriter(comptime buffer_size: usize, comptime WriterType: type) ty pub const Error = WriterType.Error; pub const Writer = io.Writer(*Self, Error, write); - /// Deprecated: use `Writer` - pub const OutStream = Writer; const Self = @This(); const FifoType = std.fifo.LinearFifo(u8, std.fifo.LinearFifoBufferType{ .Static = buffer_size }); @@ -32,11 +30,6 @@ pub fn BufferedWriter(comptime buffer_size: usize, comptime WriterType: type) ty return .{ .context = self }; } - /// Deprecated: use writer - pub fn outStream(self: *Self) Writer { - return .{ .context = self }; - } - pub fn write(self: *Self, bytes: []const u8) Error!usize { if (bytes.len >= self.fifo.writableLength()) { try self.flush(); diff --git a/lib/std/io/c_out_stream.zig b/lib/std/io/c_out_stream.zig deleted file mode 100644 index 72de85b107..0000000000 --- a/lib/std/io/c_out_stream.zig +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2015-2021 Zig Contributors -// This file is part of [zig](https://ziglang.org/), which is MIT licensed. -// The MIT license requires this copyright notice to be included in all copies -// and substantial portions of the software. -/// Deprecated: use `std.io.c_writer.CWriter` -pub const COutStream = @import("./c_writer.zig").CWriter; - -/// Deprecated: use `std.io.c_writer.cWriter` -pub const cOutStream = @import("./c_writer.zig").cWriter; diff --git a/lib/std/io/counting_out_stream.zig b/lib/std/io/counting_out_stream.zig deleted file mode 100644 index aa9610649b..0000000000 --- a/lib/std/io/counting_out_stream.zig +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2015-2021 Zig Contributors -// This file is part of [zig](https://ziglang.org/), which is MIT licensed. -// The MIT license requires this copyright notice to be included in all copies -// and substantial portions of the software. -/// Deprecated: use `std.io.counting_writer.CountingWriter` -pub const CountingOutStream = @import("./counting_writer.zig").CountingWriter; - -/// Deprecated: use `std.io.counting_writer.countingWriter` -pub const countingOutStream = @import("./counting_writer.zig").countingWriter; diff --git a/lib/std/io/counting_writer.zig b/lib/std/io/counting_writer.zig index d0c7c3b40b..f68c257486 100644 --- a/lib/std/io/counting_writer.zig +++ b/lib/std/io/counting_writer.zig @@ -15,8 +15,6 @@ pub fn CountingWriter(comptime WriterType: type) type { pub const Error = WriterType.Error; pub const Writer = io.Writer(*Self, Error, write); - /// Deprecated: use `Writer` - pub const OutStream = Writer; const Self = @This(); @@ -29,11 +27,6 @@ pub fn CountingWriter(comptime WriterType: type) type { pub fn writer(self: *Self) Writer { return .{ .context = self }; } - - /// Deprecated: use `writer` - pub fn outStream(self: *Self) OutStream { - return .{ .context = self }; - } }; } diff --git a/lib/std/io/find_byte_out_stream.zig b/lib/std/io/find_byte_writer.zig index e0e8fa871c..db45114d3e 100644 --- a/lib/std/io/find_byte_out_stream.zig +++ b/lib/std/io/find_byte_writer.zig @@ -8,9 +8,9 @@ const std = @import("../std.zig"); const io = std.io; const assert = std.debug.assert; -/// An OutStream that returns whether the given character has been written to it. +/// A Writer that returns whether the given character has been written to it. /// The contents are not written to anything. -pub fn FindByteOutStream(comptime UnderlyingWriter: type) type { +pub fn FindByteWriter(comptime UnderlyingWriter: type) type { return struct { const Self = @This(); pub const Error = UnderlyingWriter.Error; @@ -37,8 +37,8 @@ pub fn FindByteOutStream(comptime UnderlyingWriter: type) type { }; } -pub fn findByteOutStream(byte: u8, underlying_writer: anytype) FindByteOutStream(@TypeOf(underlying_writer)) { - return FindByteOutStream(@TypeOf(underlying_writer)){ +pub fn findByteWriter(byte: u8, underlying_writer: anytype) FindByteWriter(@TypeOf(underlying_writer)) { + return FindByteWriter(@TypeOf(underlying_writer)){ .underlying_writer = underlying_writer, .byte = byte, .byte_found = false, diff --git a/lib/std/io/fixed_buffer_stream.zig b/lib/std/io/fixed_buffer_stream.zig index 1711b6da1b..f86fd5a8d8 100644 --- a/lib/std/io/fixed_buffer_stream.zig +++ b/lib/std/io/fixed_buffer_stream.zig @@ -23,11 +23,7 @@ pub fn FixedBufferStream(comptime Buffer: type) type { pub const GetSeekPosError = error{}; pub const Reader = io.Reader(*Self, ReadError, read); - /// Deprecated: use `Reader` - pub const InStream = io.InStream(*Self, ReadError, read); pub const Writer = io.Writer(*Self, WriteError, write); - /// Deprecated: use `Writer` - pub const OutStream = Writer; pub const SeekableStream = io.SeekableStream( *Self, @@ -45,20 +41,10 @@ pub fn FixedBufferStream(comptime Buffer: type) type { return .{ .context = self }; } - /// Deprecated: use `reader` - pub fn inStream(self: *Self) InStream { - return .{ .context = self }; - } - pub fn writer(self: *Self) Writer { return .{ .context = self }; } - /// Deprecated: use `writer` - pub fn outStream(self: *Self) OutStream { - return .{ .context = self }; - } - pub fn seekableStream(self: *Self) SeekableStream { return .{ .context = self }; } diff --git a/lib/std/io/in_stream.zig b/lib/std/io/in_stream.zig deleted file mode 100644 index 98f94ab8ab..0000000000 --- a/lib/std/io/in_stream.zig +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2015-2021 Zig Contributors -// This file is part of [zig](https://ziglang.org/), which is MIT licensed. -// The MIT license requires this copyright notice to be included in all copies -// and substantial portions of the software. -/// Deprecated: use `std.io.reader.Reader` -pub const InStream = @import("./reader.zig").Reader; diff --git a/lib/std/io/multi_out_stream.zig b/lib/std/io/multi_out_stream.zig deleted file mode 100644 index ca21e5d70a..0000000000 --- a/lib/std/io/multi_out_stream.zig +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2015-2021 Zig Contributors -// This file is part of [zig](https://ziglang.org/), which is MIT licensed. -// The MIT license requires this copyright notice to be included in all copies -// and substantial portions of the software. -/// Deprecated: use `std.io.multi_writer.MultiWriter` -pub const MultiOutStream = @import("./multi_writer.zig").MultiWriter; - -/// Deprecated: use `std.io.multi_writer.multiWriter` -pub const multiOutStream = @import("./multi_writer.zig").multiWriter; diff --git a/lib/std/io/multi_writer.zig b/lib/std/io/multi_writer.zig index 9d838a3da4..639dd3cd18 100644 --- a/lib/std/io/multi_writer.zig +++ b/lib/std/io/multi_writer.zig @@ -22,18 +22,11 @@ pub fn MultiWriter(comptime Writers: type) type { pub const Error = ErrSet; pub const Writer = io.Writer(*Self, Error, write); - /// Deprecated: use `Writer` - pub const OutStream = Writer; pub fn writer(self: *Self) Writer { return .{ .context = self }; } - /// Deprecated: use `writer` - pub fn outStream(self: *Self) OutStream { - return .{ .context = self }; - } - pub fn write(self: *Self, bytes: []const u8) Error!usize { var batch = std.event.Batch(Error!void, self.streams.len, .auto_async).init(); comptime var i = 0; diff --git a/lib/std/io/out_stream.zig b/lib/std/io/out_stream.zig deleted file mode 100644 index c78374af01..0000000000 --- a/lib/std/io/out_stream.zig +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2015-2021 Zig Contributors -// This file is part of [zig](https://ziglang.org/), which is MIT licensed. -// The MIT license requires this copyright notice to be included in all copies -// and substantial portions of the software. -/// Deprecated: use `std.io.writer.Writer` -pub const OutStream = @import("./writer.zig").Writer; diff --git a/lib/std/io/peek_stream.zig b/lib/std/io/peek_stream.zig index 536200ad73..b431b0184d 100644 --- a/lib/std/io/peek_stream.zig +++ b/lib/std/io/peek_stream.zig @@ -16,13 +16,11 @@ pub fn PeekStream( comptime ReaderType: type, ) type { return struct { - unbuffered_in_stream: ReaderType, + unbuffered_reader: ReaderType, fifo: FifoType, pub const Error = ReaderType.Error; pub const Reader = io.Reader(*Self, Error, read); - /// Deprecated: use `Reader` - pub const InStream = Reader; const Self = @This(); const FifoType = std.fifo.LinearFifo(u8, buffer_type); @@ -31,7 +29,7 @@ pub fn PeekStream( .Static => struct { pub fn init(base: ReaderType) Self { return .{ - .unbuffered_in_stream = base, + .unbuffered_reader = base, .fifo = FifoType.init(), }; } @@ -39,7 +37,7 @@ pub fn PeekStream( .Slice => struct { pub fn init(base: ReaderType, buf: []u8) Self { return .{ - .unbuffered_in_stream = base, + .unbuffered_reader = base, .fifo = FifoType.init(buf), }; } @@ -47,7 +45,7 @@ pub fn PeekStream( .Dynamic => struct { pub fn init(base: ReaderType, allocator: *mem.Allocator) Self { return .{ - .unbuffered_in_stream = base, + .unbuffered_reader = base, .fifo = FifoType.init(allocator), }; } @@ -68,18 +66,13 @@ pub fn PeekStream( if (dest_index == dest.len) return dest_index; // ask the backing stream for more - dest_index += try self.unbuffered_in_stream.read(dest[dest_index..]); + dest_index += try self.unbuffered_reader.read(dest[dest_index..]); return dest_index; } pub fn reader(self: *Self) Reader { return .{ .context = self }; } - - /// Deprecated: use `reader` - pub fn inStream(self: *Self) InStream { - return .{ .context = self }; - } }; } diff --git a/lib/std/io/stream_source.zig b/lib/std/io/stream_source.zig index 2e68e528ae..df0d6cd352 100644 --- a/lib/std/io/stream_source.zig +++ b/lib/std/io/stream_source.zig @@ -9,7 +9,7 @@ const testing = std.testing; /// Provides `io.Reader`, `io.Writer`, and `io.SeekableStream` for in-memory buffers as /// well as files. -/// For memory sources, if the supplied byte buffer is const, then `io.OutStream` is not available. +/// For memory sources, if the supplied byte buffer is const, then `io.Writer` is not available. /// The error set of the stream functions is the error set of the corresponding file functions. pub const StreamSource = union(enum) { buffer: io.FixedBufferStream([]u8), @@ -22,11 +22,7 @@ pub const StreamSource = union(enum) { pub const GetSeekPosError = std.fs.File.GetPosError; pub const Reader = io.Reader(*StreamSource, ReadError, read); - /// Deprecated: use `Reader` - pub const InStream = Reader; pub const Writer = io.Writer(*StreamSource, WriteError, write); - /// Deprecated: use `Writer` - pub const OutStream = Writer; pub const SeekableStream = io.SeekableStream( *StreamSource, SeekError, @@ -89,20 +85,10 @@ pub const StreamSource = union(enum) { return .{ .context = self }; } - /// Deprecated: use `reader` - pub fn inStream(self: *StreamSource) InStream { - return .{ .context = self }; - } - pub fn writer(self: *StreamSource) Writer { return .{ .context = self }; } - /// Deprecated: use `writer` - pub fn outStream(self: *StreamSource) OutStream { - return .{ .context = self }; - } - pub fn seekableStream(self: *StreamSource) SeekableStream { return .{ .context = self }; } |
