New Io examples

Hey everyone, I’ve been doing a lot with the new Io interfaces, and I was wondering if there is any good recent examples or patterns with it especially featuring cancelation. The only real examples I can find are discord posts which are unresolved or older examples before a lot of the more recent changes to IO.

Thanks in advance, I think as we approach closer to 0.16 releasing it may be a good idea to start grouping together some resources for those looking for standard patterns.

This is an older example, and you’ve likely already seen it, but just posting in case you haven’t:

Gist from std.Io: simplified error handling with `Collect`

2 Likes

I used the new Io interface for zits. The most interesting files relating to the Io interface are src/Server.zig, src/Server/Client.zig, and (though only using std.Io.Reader and std.Io.Writer) src/Server/parse.zig. It’s far from optimal (I lock the entire subscriptions list on every publish right now, which does wonders for scaling (derogatory) (though it is faster than the reference implementation for low numbers of clients!)), but believe it’s at least using the Io interface correctly.

I also made a similar thread not too long ago that has some good examples to check out:

This thread where I went back and forth with Andrew was enlightening as to how to properly handle errors and cancellation:

4 Likes