Radix.lpm
You're seeing just the function
lpm
, go back to Radix module for more information.
Specs
Get the {k,v}
-pair where k
is the longest possible prefix of key.
Example
iex> elms = [{<<1, 1>>, 16}, {<<1, 1, 0>>, 24}, {<<1, 1, 0, 0::1>>, 25}]
iex> t = new(elms)
iex> lpm(t, <<1, 1, 0, 127>>)
{<<1, 1, 0, 0::1>>, 25}
#
iex> lpm(t, <<1, 1, 0, 128>>)
{<<1, 1, 0>>, 24}
#
iex> lpm(t, <<1, 1, 1, 1>>)
{<<1, 1>>, 16}
#
iex> lpm(t, <<2, 2, 2, 2>>)
nil