socket_addr_macros

Crates.iosocket_addr_macros
lib.rssocket_addr_macros
version1.0.1
sourcesrc
created_at2023-02-06 13:03:10.136302
updated_at2023-02-08 02:45:10.080795
descriptionCheck and parse SocketAddr at compile-time
homepage
repositoryhttps://github.com/hiraginoyuki/socket_addr_macros
max_upload_size
id777913
size10,471
hiraginoyuki (hiraginoyuki)

documentation

README

socket_addr_macros

Macros that can check and parse a SocketAddr at compile-time.

Examples

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();
    }
}
Commit count: 12

cargo fmt