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

RFC for creation of IntoRaw{Fd, Socket, Handle} trait to complement AsRaw* #1174

Merged
merged 1 commit into from
Jul 16, 2015
Merged

RFC for creation of IntoRaw{Fd, Socket, Handle} trait to complement AsRaw* #1174

merged 1 commit into from
Jul 16, 2015

Conversation

ipetkov
Copy link
Contributor

@ipetkov ipetkov commented Jun 24, 2015

@ipetkov
Copy link
Contributor Author

ipetkov commented Jun 24, 2015

cc @alexcrichton @aturon

@alexcrichton alexcrichton added the T-libs-api Relevant to the library API team, which will review and decide on the RFC. label Jun 24, 2015
@alexcrichton alexcrichton self-assigned this Jun 30, 2015
@sfackler
Copy link
Member

sfackler commented Jul 1, 2015

I like the idea of this functionality, but I'd go with Into<RawFd> etc instead of defining new traits. The common convention is to both implement Into<Foo> and add an into_foo() method to a type, since Into is useful in a generic context but can be a bit of a pain to use if you have a concrete TcpStream or whatever that has multiple Into impls.

@alexcrichton
Copy link
Member

Unfortunately using Into<RawFd> means that when you convert an object to a file descriptor there's no platform-specific opt-in, you instead just call let a: i32 = file.into() and it becomes a portability hazard. In having separate traits you acknowledge the platform-specific-ness via use std::os::unix::....

@sfackler
Copy link
Member

sfackler commented Jul 1, 2015

Ah, yeah, that makes sense. I'm on board with IntoRaw{Fd,Handle,Socket} then.

@l0kod
Copy link

l0kod commented Jul 6, 2015

👍

@alexcrichton
Copy link
Member

This RFC is now entering its week-long final comment period.

@alexcrichton alexcrichton added the final-comment-period Will be merged/postponed/closed in ~10 calendar days unless new substational objections are raised. label Jul 8, 2015
@alexcrichton
Copy link
Member

The consensus of the libs team this week is to merge this RFC, so I'm going to do so. Thanks again for the RFC @ipetkov!

Tracking issue

@alexcrichton alexcrichton merged commit 605af89 into rust-lang:master Jul 16, 2015
@ipetkov ipetkov deleted the into-raw-trait branch July 16, 2015 08:19
@aturon aturon mentioned this pull request Jul 16, 2015
@Centril Centril added the A-net Proposals relating to networking. label Nov 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-net Proposals relating to networking. final-comment-period Will be merged/postponed/closed in ~10 calendar days unless new substational objections are raised. T-libs-api Relevant to the library API team, which will review and decide on the RFC.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants