Iptrie.fetch-exclamation-mark

You're seeing just the function fetch-exclamation-mark, go back to Iptrie module for more information.

Specs

fetch!(t(), prefix()) :: {prefix(), any()} | KeyError | ArgumentError

Fetches the prefix,value-pair for given prefix from trie (exact match).

In case of success, returns {prefix, value}.
If prefix is not present, raises a KeyError.
If prefix could not be encoded, raises an ArgumentError.

Example

iex> ipt = new()
...> |> put("10.10.10.0/24", "ten")
...> |> put("11.11.11.0/24", "eleven")
iex>
iex> fetch!(ipt, "10.10.10.0/24")
{"10.10.10.0/24", "ten"}
iex>
iex> fetch!(ipt, "12.12.12.12")
** (KeyError) prefix "12.12.12.12" not found

iex> ipt = new()
iex> fetch!(ipt, "13.13.13.333")
** (ArgumentError) invalid prefix "13.13.13.333"