Radix.exec

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

Specs

exec(tree(), ({key(), value()}, acc() -> acc()), acc()) :: acc()

Executes fun on all key,value-pairs in the radix tree in a depth-first fashion.

fun's signature is ({key/0, value/0}, acc/0) -> acc/0, where the caller supplies both fun and acc.

Example

iex> t = new([
...>  {<<1, 1, 1, 0::1>>, "1.1.1.0/25"},
...>  {<<1, 1, 1, 1::1>>, "1.1.1.128/25"},
...>  {<<1, 1, 1>>, "1.1.1.0/24"},
...>  {<<3>>, "3.0.0.0/8"},
...>  ])
iex>
iex> # get values
iex>
iex> f = fn {_key, value}, acc -> [value | acc] end
iex> exec(t, f, []) |> Enum.reverse()
["1.1.1.0/25", "1.1.1.0/24", "1.1.1.128/25", "3.0.0.0/8"]