Skip to content

hiraginoyuki/socket_addr_macros

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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();
    }
}

About

socket_addr!() and socket_addr_dyn!()

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages