Struct IPv4
A simple wrapper struct to string-represent IPv4 without allocating
struct IPv4
;
Methods
Name | Description |
---|---|
fromHost
(v)
|
|
toString
(sink)
|
Provides a string representation of this IP |
Example
IPv4 all = IPv4(0);
assert(all .toString() == "0.0.0.0");
IPv4 bc = IPv4(uint .max);
assert(bc .toString() == "255.255.255.255");
version (LittleEndian)
IPv4 home = IPv4 .fromHost(0x0100_007F);
else
IPv4 home = IPv4 .fromHost(0x7F00_0001);
assert(home .toString() == "127.0.0.1");