How to print ip address and port from tcplistener

Im trying to build a tcp server and want to be able to print the port and ip address
I try this:

let listener = TcpListener::bind("127.0.0.1:7878").unwrap();
println!(" {:?}", listener); // will print "TcpListener { addr: V4(127.0.0.1:7878), fd: 3 }"
println!(" {}", listener.addr); // This one will fail

Why i cannot print the addr from the struct?
the second println! will fail with the following message:
10 | println!(" {}", listener.addr);
| ^^^^ unknown field

Have you looked at the docs for TcpListener?

2 Likes