Iptrie.new

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

Specs

new() :: t()

Creates an new, empty Iptrie.

Example

iex> Iptrie.new()
%Iptrie{}

Specs

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

Creates a new Iptrie, populated via a list of prefix,value-pairs.

Example

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