Iptrie.less

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

Specs

less(t(), prefix()) :: [{prefix(), any()}]

Return all the prefix,value-pairs whose prefix is a prefix for the given search prefix.

This returns the less specific entries that enclose the given search prefix. Note that any bitstring is always a prefix of itself. So, if present, the search key will be included in the result.

If prefix is not present or not valid, or cannot be encoded as an Ipv4 op IPv6 Pfx.t/0, an empty list is returned.

Example

iex> ipt = new()
...> |> put("1.1.1.0/25", "A25-lower")
...> |> put("1.1.1.128/25", "A25-upper")
...> |> put("1.1.1.0/30", "A30")
...> |> put("1.1.2.0/24", "B24")
iex>
iex> less(ipt, "1.1.1.0/30")
[
  {"1.1.1.0/30", "A30"},
  {"1.1.1.0/25", "A25-lower"},
]
iex> less(ipt, "2.2.2.2")
[]