How can I create an in_channel from a string?

Yes you can, there’s an associated ownership discipline:

I didn’t understand that, but I’m pretty sure we could gradually build high-level functions on top of this, e.g. to make it convenient to simply ask for n bytes and not be subject to the vagaries of the amount the client will return you while avoiding as much as possible copying (I was trying to do that a long time ago here, didn’t look at this code for ages so not claiming it’s particularly nice/good).

1 Like

Yes you can, there’s an associated ownership discipline

Yes yes, that’s what clicked for me. It makes sense.

The consume interface means that instead of input having the side effect of moving forward the position into the underlying stream of byte; input always returns the same buffer. You need to call consume separately to move forward. See for example rust’s BufRead trait which has fill_buffer (like input) and consume.