Iptrie.find
You're seeing just the function
find
, go back to Iptrie module for more information.
Specs
Finds a prefix,value-pair for given prefix
from trie
(longest match).
In case of success, returns {:ok, {prefix, value}}.
If prefix
had no match, 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> find(ipt, "1.1.1.0/24")
{:ok, {"1.1.1.0/24", "one"}}
iex>
iex> find(ipt, "12.12.12.12")
{:error, :notfound}
iex>
iex> find(ipt, "13.13.13.333")
{:error, :notprefix}