Iptrie.fetch

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

Specs

fetch(t(), prefix()) :: {:ok, {prefix(), any()}} | {:error, atom()}

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

In case of success, returns {:ok, {prefix, value}}.
If prefix is not present, returns {:error, :notfound}.
In case of encoding errors for prefix, returns {:error, :notprefix}

Example

iex> ipt = new()
...> |> put("1.1.1.0/24", "one")
...> |> put("2.2.2.0/24", "two")
iex>
iex> fetch(ipt, "1.1.1.0/24")
{:ok, {"1.1.1.0/24", "one"}}
iex>
iex> fetch(ipt, "12.12.12.12")
{:error, :notfound}
iex>
iex> fetch(ipt, "13.13.13.333")
{:error, :notprefix}