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

Conversation

Projects
None yet
5 participants
@ipetkov
Copy link
Contributor

ipetkov commented Jun 24, 2015

@ipetkov

This comment has been minimized.

Copy link
Contributor Author

ipetkov commented Jun 24, 2015

@alexcrichton alexcrichton added the T-libs label Jun 24, 2015

@alexcrichton alexcrichton self-assigned this Jun 30, 2015

@sfackler

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

alexcrichton commented Jul 1, 2015

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

This comment has been minimized.

Copy link
Member

sfackler commented Jul 1, 2015

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

@l0kod

This comment has been minimized.

Copy link

l0kod commented Jul 6, 2015

👍

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jul 8, 2015

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

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jul 16, 2015

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 ipetkov:into-raw-trait branch Jul 16, 2015

@aturon aturon referenced this pull request Jul 16, 2015

Closed

io error handling design #770

@Centril Centril added the A-net label Nov 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.