Iptrie.less
You're seeing just the function
less
, go back to Iptrie module for more information.
Specs
Returns 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, unless
the option :exclude
is set to true
, the search key will be included in
the result if present. Any other value for :exclude
is interpreted as
false, which means the default action is to include the search key, if
present.
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")
[]
#
# exclusive search
#
iex> less(ipt, "1.1.1.0/30", exclude: true)
[{"1.1.1.0/25", "A25-lower"}]