method IpAddr.parse
Parses numeric IPv4 / IPv6 text (names are not resolved: see dns.lookup).
Example:
use std.net { IpAddr }
fn main() io {
match IpAddr.parse("10.0.0.256") {
IpAddr ip => print(ip.toString())
ParseError e => print(e.msg)
}
}Вывод
invalid IP address `10.0.0.256`
pub(api) static fn parse(text: str) -> IpAddr | ParseErrorСложность. O(n) in the length of the text.
С версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
text | str |
Возвращает
Ошибки
ParseError@error- `ParseError` for text that is not a numeric IPv4 or IPv6 address (names are not resolved).
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/net/net.oxl:131