I have some code that is migrating to async, it's using the
tar crate (sync) currently and while https://crates.io/crates/tokio-tar exists it isn't updated for tokio 1.0 and I'm also trying to avoid rewriting everything at once.
This topic is hard to search for but basically are there crates or APIs I might be missing to bridge between e.g.
Read? I came up with this helper ostree-rs-ext/import.rs at 17a991050c5bf371633695b0bbd5cdbb3d717bca · ostreedev/ostree-rs-ext · GitHub
But it's suboptimal in various ways, e.g. the write is blocking. I think what it should be doing is converting one fd from the pipe using an AsyncFd etc.
Then the more I looked at this, the way we're constantly allocating
Bytes here also seems wrong; probably want to have a shared
BytesMut with a mutex or so (effectively replicating an OS level pipe in process)? But I got uncertain about using e.g. a tokio Mutex inside both async and a sync spawned helper thread.
Anyways I'm sure I'm not the first person to hit this but I haven't found a good way to do a web search for this because all the keywords are too generic.
Seems like something like this would be worthy to have in at least tokio_util::io perhaps?