Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enh request: Implement async read/write traits #30

Open
rbtcollins opened this issue Dec 26, 2023 · 4 comments
Open

enh request: Implement async read/write traits #30

rbtcollins opened this issue Dec 26, 2023 · 4 comments

Comments

@rbtcollins
Copy link

e.g. AsyncRead, AsyncBufRead etc. This would require a dependency on futures, so perhaps a feature flag. Wouldn't need to bring in tokio or anything large, and as far as I can tell aligns well with the intent of a mid-layer crate.

@rbtcollins
Copy link
Author

rbtcollins commented Dec 26, 2023

(Converting via tokio's asyncfd support isn't possible today, because there is no anonymous Pipe layer today, only unix fd's and windows NamedPipes. Another route forward would be to switch to namedpipes.

https://docs.rs/tokio/latest/tokio/io/unix/struct.AsyncFd.html?search=asyncfd

@NobodyXu
Copy link

imo there's tokio-pipe for tokio

@rbtcollins
Copy link
Author

rbtcollins commented Dec 27, 2023

@NobodyXu oh, thank you, will give that a go, but its not a like-for-like drop in as I can see: it requires unsafe and bouncing through asrawfd / from rawfd - which os_pipe can be used this way as well - nothing like the ergonomics of os_pipe for std::process:Command.

@NobodyXu
Copy link

@rbtcollins which function is missing?

There's a pipe() for creating pipes, though there isn't a try_clone() function.

Do you need try_clone()?

It should be very easy to add that support to the crate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants