NetworkPort
A TCP or UDP port (IANA), from 1 to 65535.
Web and network; ordered; since Jadpo 0.1.0.
Make one
Build one from a whole number from 1 to 65535, NetworkPort(22); a number outside them breaks min or max.
text.parse(raw, as: NetworkPort) reads one from its text; text that isn't one at all fails malformed, such as 0, 65536 or 080.
Text, JSON and storage
text.from writes its canonical text, the one form text.parse reads back. JSON sends it as a number.
| Text | JSON |
|---|---|
22 |
22 |
443 |
443 |
8080 |
8080 |
65535 |
65535 |
It is stored in one column named for the field, of type integer. 8080 is stored as 8080.
Shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
22 |
22 |
443 |
443 |
8080 |
8080 |
65535 |
65535 |
Operations
It has the contract's own operations: text.parse, text.from, text.format, json.read, json.write and ==. It is ordered, so < and sorting take it. Every standard type meets one contract says how they work.
Markdown for agents: /docs/types/type-network-port.md.Built from Jadpo main at e00e61f.