Iptrie.new

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

Specs

new() :: t()

Create an new, empty Iptrie.

Example

iex> Iptrie.new()
%Iptrie{}

Specs

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

Create a new Iptrie, populated via a list of {prefix/0, any/0}-pairs.

Example

iex> ipt = Iptrie.new([{"1.1.1.0/24", "net1"}, {"acdc:1975::/32", "TNT"}])
iex> Map.get(ipt, 32)
{0, [{<<1, 1, 1>>, "net1"}], nil}
iex> Map.get(ipt, 128)
{0, nil, [{<<172, 220, 25, 117>>, "TNT"}]}