netlit

Crates.ionetlit
lib.rsnetlit
version0.1.2
created_at2025-06-15 11:59:46.07542+00
updated_at2025-06-16 22:38:27.280103+00
descriptionExpress literal IP addresses and socket addresses directly in code
homepagehttps://crates.io/crates/netlit
repositoryhttps://github.com/aatifsyed/netlit
max_upload_size
id1713206
size8,156
Aatif Syed (aatifsyed)

documentation

https://docs.rs/netlit

README

Express Ipv4Addr and SocketAddrV4 directly in code:

assert_eq!(netlit!(127.0.0.1), Ipv4Addr::LOCALHOST);
assert_eq!(netlit!(127.0.0.1:8000), SocketAddrV4::new(Ipv4Addr::LOCALHOST, 8000));
const SUPPORT: SocketAddrV4 = netlit!(127.0.0.1:8000);
assert_eq!(netlit!(::1), Ipv6Addr::LOCALHOST);
assert_eq! {
    netlit!([dead:beef::1%30]:8000),
    SocketAddrV6::new(Ipv6Addr::new(0xdead, 0xbeef, 0, 0, 0, 0, 0, 1), 8000, 0, 30)
};
Commit count: 12

cargo fmt