I found this code on the tokio hello world page:
fn main() {
let addr = "127.0.0.1:6142".parse().unwrap();
let listener = TcpListener::bind(&addr).unwrap();
// Following snippets come here...
}
Is the Rust compiler actually smart enough to infer that the type that the string holding the IP address should be parsed to is std::net::SocketAddr
because the parsed variable is passed to the bind method which expects that type? Why don't you need to use the turbofish operator (::<>) or an explicit type annotation?