SHARE
TWEET

Untitled

a guest Oct 21st, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use std::net::SocketAddr;
  2. use std::net::ToSocketAddrs;
  3.  
  4. fn main() {
  5.     let endpoint: SocketAddr =
  6.         "localhost:1234".parse().unwrap(); // Raises AddrParseError.
  7.        
  8.     let endpoint: SocketAddr =
  9.         "localhost:1234".to_socket_addrs().unwrap().next().unwrap(); // OK
  10. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top