Iptrie.fetch-exclamation-mark

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

fetch!(trie, prefix, opts \\ [])

View Source

Specs

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

Fetches the prefix,value-pair for given prefix from trie.

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

Optionally fetches based on a longest prefix match by specifying match: :lpm.

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, "11.11.11.11", match: :lpm)
{"11.11.11.0/24", "eleven"}
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) expected a valid prefix, got "13.13.13.333"