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

Implement AsRawFd for Stdin, Stdout, Stderr, and RawFd #2074

Closed
ids1024 opened this issue Jul 24, 2017 · 5 comments
Closed

Implement AsRawFd for Stdin, Stdout, Stderr, and RawFd #2074

ids1024 opened this issue Jul 24, 2017 · 5 comments
Labels
T-libs-api Relevant to the library API team, which will review and decide on the RFC.

Comments

@ids1024
Copy link

ids1024 commented Jul 24, 2017

Is there a reason this is not the case already, or is it just that it is unnecessary for the typical use case and hasn't been added? Would something like this require an RFC, or would a PR suffice?

@sfackler
Copy link
Member

This seems fine for Stdin/Stdout/Stderr, but RawFd is just a typedef for c_int, and it seems a bit weird to implement that trait for a number.

@BurntSushi
Copy link
Member

Yeah, I'd also like this for Stdin/Stdout/Stderr. I don't think you'd need an RFC for it.

@ids1024
Copy link
Author

ids1024 commented Jul 24, 2017

My use case is for a function with the signature <T: AsRawFd>(stream: &T), which is why I suggest implementing it for RawFd as well. But the Std* types are the relevant ones really.

@codyps
Copy link

codyps commented Jul 24, 2017

On RawFd, see rust-lang/rust#41035 . We'd need a RawFd-like that was a wrapper struct to have an AsRawFd impl. This issue notes the need for a newtype: rust-lang/rust#43254 .

bors added a commit to rust-lang/rust that referenced this issue Aug 4, 2017
Implement AsRawFd for Stdin, Stdout, and Stderr

rust-lang/rfcs#2074
@ids1024
Copy link
Author

ids1024 commented Aug 4, 2017

The implementation for Std* is now merged; but not for RawFd, due to the concern mentioned above.

@ids1024 ids1024 closed this as completed Aug 4, 2017
@Centril Centril added the T-libs-api Relevant to the library API team, which will review and decide on the RFC. label Feb 23, 2018
Centril added a commit to Centril/rust that referenced this issue Mar 29, 2019
Centril added a commit to Centril/rust that referenced this issue Mar 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-libs-api Relevant to the library API team, which will review and decide on the RFC.
Projects
None yet
Development

No branches or pull requests

5 participants