std: add type-erased reader; base GenericReader on it

The idea here is to avoid code bloat by having only one actual io.Reader
implementation, which is type erased, and then implement a GenericReader
that preserves type information on top of that as thin glue code.

The strategy here is for that glue code to `@errSetCast` the result of
the type-erased reader functions, however, while trying to do that I
ran into #17343.
This commit is contained in:
Andrew Kelley
2023-09-30 18:11:27 -07:00
parent 4df7f7c86a
commit d8540dd708
5 changed files with 1019 additions and 761 deletions

View File

@@ -265,7 +265,7 @@ set(ZIG_STAGE2_SOURCES
"${CMAKE_SOURCE_DIR}/lib/std/io/find_byte_writer.zig"
"${CMAKE_SOURCE_DIR}/lib/std/io/fixed_buffer_stream.zig"
"${CMAKE_SOURCE_DIR}/lib/std/io/limited_reader.zig"
"${CMAKE_SOURCE_DIR}/lib/std/io/reader.zig"
"${CMAKE_SOURCE_DIR}/lib/std/io/Reader.zig"
"${CMAKE_SOURCE_DIR}/lib/std/io/seekable_stream.zig"
"${CMAKE_SOURCE_DIR}/lib/std/io/writer.zig"
"${CMAKE_SOURCE_DIR}/lib/std/json.zig"