daily pastebin goal
13%
SHARE
TWEET

Untitled

a guest Jan 21st, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use std::net::{AddrParseError, Ipv4Addr};
  2.  
  3. fn main() -> Result<(), AddrParseError> {
  4.     let strings = vec!["10.0.0.1", "192.168.0.1", "1.1.1.1"];
  5.  
  6.     let ip_addresses: Result<Vec<Ipv4Addr>, AddrParseError> =
  7.         strings.iter().map(|s| s.parse()).collect();
  8.  
  9.     println!("IPs: {:?}", ip_addresses);
  10.  
  11.     Ok(())
  12. }
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