-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Differents type signature (address, port) for TCP and UDP connection #18269
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
By the way, I'm ok to submit a PR if somebody can tell me which version should be implemented (if it's not made on purpose) |
The vague reasoning behind this was that by taking That's not a very strong argument, however, and these likely need to be redesigned to be unified. |
Another possible solution is to extend pub enum AddrType {
HostNameAddress(String),
IpAddress(IpAddr),
}
pub struct SocketAddr {
pub addr: AddrType,
pub port: Port,
} just for illustration. |
I think this issue can be closed now. Both |
Yup! |
…-formatting, r=flodiebold hir-ty: change struct + enum variant constructor formatting. before, when formatting struct constructor for `struct S(usize, usize)` it would format as: extern "rust-call" S(usize, usize) -> S but after this change, we'll format as: fn S(usize, usize) -> S likewise the second commit, also makes this uniform for enum variants as well. fixes rust-lang#18259
Hi,
The closest ticket that I could find was #14755 but it seems closed due to inactivity.
There is maybe a reason but I found a bit odd that TCP connection is done via ( &str , u16 ) and UDP via std::io::net::ip::SocketAddr . Looking at the history it seem like TCP changed to step away from SocketAddr.
TCP:
rust/src/libstd/io/net/tcp.rs
Line 350 in 56d544f
UDP:
rust/src/libstd/io/net/udp.rs
Line 68 in 56d544f
Thanks.
The text was updated successfully, but these errors were encountered: