seed
seed copied to clipboard
[proposal] Read or Iterator interface to seed::fetch::Response
Currently seed::fetch::Response has 3 interfaces: text, json, bytes. I'm working on something now which is fetching a large amount of non-text data, bytes can work but it is not ideal as it is unnecessarily allocating a large Vec in the wasm memory.
I propose to add an interface returning either a Read or an Iterator. Also, as either of these can fairly easily create a Vec<u8>, maybe we can replace the existing bytes.
I will try to come up with a function today, but am also wondering what others think.
I (and I think the most users) use only json and text.
bytes has been requested by one user without any specific API requirement. Feel free to design and add new methods or replace existing bytes.
Thanks, I'll try a few things out and update.
I tried a std::io::Read interface but for my use case it just caused lots of small allocations instead of one large one. I'll come back to this if I can solve that issue.