3 ms·
> (IpAddr::V4(Ipv4Addr::new( Rust is so simple and clear :3
by andrepd 4y ago
> (IpAddr::V4(Ipv4Addr::new(
Rust is so simple and clear :3
- proto_lambda 4y agoThe C equivalent would be a bunch of `in_addr`/`sockaddr_in`/`sockaddr` handling where you can do something wrong at basically every step of the way. You can't mess up the types in Rust, there's only one way they fit together. Of course if you just want to convert a string to a SocketAddr (returning an error at runtime if it's invalid), you just do `let addr = "127.0.0.1:8080".parse();`.