0

How can I convert a SocketAddr into a String? I know how to do the conversion the other way round.

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366

1 Answers1

4

You convert it to a string by calling to_string:

fn example(addr: &SocketAddr) -> String {
    addr.to_string()
}

See also:

Stargateur
  • 24,473
  • 8
  • 65
  • 91
Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366