Radix.fetch
You're seeing just the function
fetch
, go back to Radix module for more information.
Specs
Fetches the key,value-pair for a specific key
in the given tree
.
Returns {:ok, {key, value}}
or :error
when key
is not in the tree
. By
default an exact match is used, specify match: :lpm
to fetch based on a
longest prefix match.
Example
iex> t = new([{<<>>, 0}, {<<1>>, 1}, {<<1, 1>>, 2}])
iex> fetch(t, <<1, 1>>)
{:ok, {<<1, 1>>, 2}}
iex>
iex> fetch(t, <<2>>)
:error
iex> fetch(t, <<2>>, match: :lpm)
{:ok, {<<>>, 0}}