BitwiseIp.parse-exclamation-mark
You're seeing just the function
parse-exclamation-mark
, go back to BitwiseIp module for more information.
Specs
An error-raising variant of parse/1
.
This function parses IPv4 and IPv6 strings in their respective notations and
produces an encoded BitwiseIp
struct. If the string is invalid, it raises
an ArgumentError
.
BitwiseIp
implements the String.Chars
protocol, so parsing can be undone
using to_string/1
.
Examples
iex> BitwiseIp.parse!("127.0.0.1")
%BitwiseIp{proto: :v4, addr: 2130706433}
iex> BitwiseIp.parse!("::1")
%BitwiseIp{proto: :v6, addr: 1}
iex> BitwiseIp.parse!("not an ip")
** (ArgumentError) Invalid IP address "not an ip"
iex> BitwiseIp.parse!("192.168.0.1") |> to_string()
"192.168.0.1"
iex> BitwiseIp.parse!("fc00::") |> to_string()
"fc00::"