News for hackers. Stuff that matters.
Re:Announcing Tokio 0.1 by carllerche on Wednesday January 11, 2017 @01:06PM (#13375969)
Rust uses type inference to figure that out. Because `addr` gets passed to `TcpListener::bind` which requires a `SocketAddr`, the type inferencer knows that `addr` should be a SocketAddr and so it all works :)
Re:Announcing Tokio 0.1 by curun1r on Wednesday January 11, 2017 @01:58PM (#13376471)
You might also add that it only works because SocketAddr implements FromStr. Type inference will only determine which version of from_str to call, it won't actually do the parsing.
Re:Announcing Tokio 0.1 by flukus on Wednesday January 11, 2017 @06:44PM (#13378548)
That type inference goes well beyond most others though.