-
Notifications
You must be signed in to change notification settings - Fork 13.3k
TcpStream (and probably more std::net types) missing Debug impl #23134
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
Comments
Hi, if it's ok, I'd like to work on this issue. I have a commit in my local repo which resolves this but I need to test it some more to be sure. Hopefully, I can open a PR with the changes later tonight. |
Sure! |
@sfackler Hi, I'm trying to test my changes but I'm running into an issue.
Any ideas? |
You need to set your |
Thanks, that did the trick. I found several types in
Does that look right? Should I try to get rid of the inner |
@sfackler Sorry, I think I forgot to mention you in that last comment. |
Ah yeah, sorry. I'd go without the |
Implement types for: - Shutdown - TcpStream - TcpListener - UdpSocket Fixes rust-lang#23134
@wesleywiser Are you still working on this? |
No, I ran into some issues trying to figure out how to get at the file On Fri, Apr 24, 2015, 4:31 PM Nick Hamann [email protected] wrote:
|
I've started working on this. I have a branch here: nham@6ac730a |
I'm uncertain whether the 3 implementations in `net2` should unwrap the socket address values. Without unwrapping it looks like this: ``` UdpSocket { addr: Ok(V4(127.0.0.1:34354)), inner: 3 } TcpListener { addr: Ok(V4(127.0.0.1:9123)), inner: 4 } TcpStream { addr: Ok(V4(127.0.0.1:9123)), peer: Ok(V4(127.0.0.1:58360)), inner: 5 } ``` One issue is that you can create, e.g. `UdpSocket`s with bad addresses, which means you can't just unwrap in the implementation: ``` #![feature(from_raw_os)] use std::net::UdpSocket; use std::os::unix::io::FromRawFd; let sock: UdpSocket = unsafe { FromRawFd::from_raw_fd(-1) }; println!("{:?}", sock); // prints "UdpSocket { addr: Err(Error { repr: Os(9) }), inner: -1 }" ``` Fixes #23134.
It seems like these types could implement Debug (allowing structs that contain std::net values to be able to derive Debug).
cc @alexcrichton
The text was updated successfully, but these errors were encountered: