ipzone

Ipzone provides a simple and powerful IP architecture to Rust.

CI Crates.io Licensed Twitter

| Examples | Docs | Latest Note |

toml ipzone = "0.1.0"

Examples

```rust use ipzone::prelude::*;

const LOCAL: Localhost<3> = Localhost([6004, 7040, 8080]);

// Localhost has implemented ToSocketAddrs trait so // can server.bind(LOCAL); ```

rust // From environment variables let local = Localhost([6004, 7040, port::from_env!("PORT")]); // unwrap_or(8080) version is port::from_env!("PORT", 8080)

rust // From json files (features = "json") // -- ../ports.json -- // [ 1234, 5678, 9101, 4321 ] let local = Localhost(port::from_json!("../ports.json"; 4)); // can truncate it, port::from_json("../ports.json"; 2) = [ 1234, 5678 ]

```rust // Concatenating let ports: [u16; 4] = port::concatn!( [ [1234, port::fromenv!("PORT")] port::fromjson!("../ports.json"; 2) ] );

let local = Localhost(ports); ```