Radix.lookup

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

Specs

lookup(tree(), key()) :: {key(), value()} | nil

Returns the key,value-pair whose key is the longest prefix of key, or nil.

Returns {key, value} or nil if there was no match.

Example

iex> elms = [{<<1, 1>>, 16}, {<<1, 1, 0>>, 24}, {<<1, 1, 0, 0::1>>, 25}]
iex> t = new(elms)
iex> lookup(t, <<1, 1, 0, 127>>)
{<<1, 1, 0, 0::1>>, 25}
iex> lookup(t, <<1, 1, 0, 128>>)
{<<1, 1, 0>>, 24}
iex> lookup(t, <<1, 1, 1, 1>>)
{<<1, 1>>, 16}
iex> lookup(t, <<2, 2, 2, 2>>)
nil