Radix.longest_match

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

longest_match(tree, key)

View Source

Specs

longest_match(tree() | leaf(), key()) :: {key(), value()} | nil

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> longest_match(t, <<1, 1, 0, 127>>)
{<<1, 1, 0, 0::1>>, 25}
#
iex> longest_match(t, <<1, 1, 0, 128>>)
{<<1, 1, 0>>, 24}
#
iex> longest_match(t, <<1, 1, 1, 1>>)
{<<1, 1>>, 16}
#
iex> longest_match(t, <<2, 2, 2, 2>>)
nil