socket!() { /* proc-macro */ }Expand description
Generates a socket address from its string representation
§Syntax
This macro works as a function which take only one argument: the string representation of a socket address
§Example
assert_eq!(socket!("[::1]:3000"), std::net::SocketAddr::V6(std::net::SocketAddrV6::new(std::net::Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), 3000, 0, 0)));
assert_eq!(socket!("192.168.1.5:3000"), std::net::SocketAddr::V4(std::net::SocketAddrV4::new(std::net::Ipv4Addr::new(192, 168, 1, 5), 3000)));