Crates.io | socket_addr_macros |
lib.rs | socket_addr_macros |
version | 1.0.1 |
source | src |
created_at | 2023-02-06 13:03:10.136302 |
updated_at | 2023-02-08 02:45:10.080795 |
description | Check and parse SocketAddr at compile-time |
homepage | |
repository | https://github.com/hiraginoyuki/socket_addr_macros |
max_upload_size | |
id | 777913 |
size | 10,471 |
Macros that can check and parse a SocketAddr at compile-time.
use socket_addr_macros::socket_addr;
use std::net::TcpListener;
use std::io::Write;
fn main() {
let listener = TcpListener::bind(socket_addr!(127.0.0.1:8080)).unwrap();
while let Ok((mut conn, _)) = listener.accept() {
conn.write(b"hello").unwrap();
}
}