Those details are up to the Io implementation, Threaded uses a linked list with heap allocated nodes.
You can propagate the error through an out parameter, but it is just better practice to deal with them in handleConnection.
it is, cancel does return the result of the task if it finished before it could be cancelled, you have to deal with that defer if(accept.cance(io)) |stream| stream.close() else |_| {};
I’m surprised that discarding hides the type mismatch of the success case being a stream and the error case being void (your catch {}). Though I can see how It’d make sense to do that, I dont think it should as it hides resource managment errors like this.
the interfaces have no knowledge of Io, and they shouldn’t, otherwise they wouldn’t be arbitrary streams of data.
The implementation however should go through Io, which you can see as you have to give it io when you create them.