Radix.put
You're seeing just the function
put
, go back to Radix module for more information.
Specs
Stores {key
, value
}-pairs in the radix tree
.
Any existing key
's will have their value
's replaced.
Examples
iex> elements = [{<<1, 1>>, "1.1.0.0/16"}, {<<1, 1, 1, 1>>, "1.1.1.1"}]
iex> new() |> put(elements)
{0,
{23, [{<<1, 1>>, "1.1.0.0/16"}],
[{<<1, 1, 1, 1>>, "1.1.1.1"}]},
nil
}
Specs
Store a {key
,value
}-pair in the radix tree
.
Any existing key
will have its value
replaced.
Examples
iex> t = new()
...> |> put(<<1, 1>>, "1.1.0.0/16")
...> |> put(<<1, 1, 1, 1>>, "x.x.x.x")
iex> t
{0,
{23, [{<<1, 1>>, "1.1.0.0/16"}],
[{<<1, 1, 1, 1>>, "x.x.x.x"}]},
nil
}
#
iex> put(t, <<1, 1, 1, 1>>, "1.1.1.1")
{0,
{23, [{<<1, 1>>, "1.1.0.0/16"}],
[{<<1, 1, 1, 1>>, "1.1.1.1"}]},
nil
}