Zig's new Reader and Writer interfaces (std.Io, 0.15.1)

Опубликовано: 17 Май 2026
на канале: ComputerBread
19,382
772

Hello, this is ComputerBread,
back at it again, with another zig video, today it's time to talk about std.Io.Reader and std.Io.Writer, the two new intrusive interfaces that Zig 0.15.1 just shipped. This version is the first step toward the return of async and a revolutionary new way to handle IO! These new interfaces come with buffers built-in to minimize syscalls and indirect calls, and also to help the compiler make optimizations!

In this video, I explain how to use the new Reader and Writer interfaces, explain how they work, I justify the reasons made! I also talked about concrete implementations: std.fs.File.Reader, std.fs.File.Writer, std.Io.Writer.Allocating, std.Io.Writer.Discarding....
I show how to read from the standard input (stdin) and from a file, and how to write to the standard output! I also talk about common mistakes to avoid!


zig version 0.15.1

---

Want to level up? Try scrimba, the best way to learn programming
Sign up for free or go Pro with 20% off:
https://scrimba.com/?via=computerbread
(affiliate link, I may earn a commission if you sign up through this link)

Zig playlist:    • zig  
Leetcode playlist:    • Interview Question  
JavaScript playlist:    • JavaScript  

To support me (if you feel like it): https://ko-fi.com/computerbread/
Cheatcheet/mindmap: https://ko-fi.com/s/34966c8fb1
Twitter:   / computerbread  
Subscribe:    / @computerbread  

----
links:
code snippets: https://github.com/ComputerBread/vide...
Learn about Intrusive Interfaces:    • Zig's Intrusive interface, LinkedList and ...  
https://ziglang.org/download/0.15.1/r...
https://ziggit.dev/t/libucw-fastbufs-...
https://ziggit.dev/t/is-zig-error-pro...
https://github.com/ziglang/zig/pull/2...
https://ziggit.dev/t/0-15-1-changes/1...
https://ziggit.dev/t/0-15-1-reader-wr...
https://www.openmymind.net/Zigs-New-W...
https://ziggit.dev/t/im-too-dumb-for-...
http://ithare.com/infographics-operat...
   • Don't Forget To Flush by Andrew Kelley  
ziggit thread: https://ziggit.dev/t/video-zigs-new-r...
reddit thread:   / zigs_new_stdioreader_and_stdiowriter_inter...  

---




Step by step guide easy to understand, well explained, amazing, awesome, the best video you've ever seen!
zig programming language, intrusive interface, polymorphism, C, C++, rust, odin, low level programming, comptime, static dispatch, dynamic dispatch, vtable, Reader, Writer, streaming interface, input, output, IO