Iptrie.put

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

Specs

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

Puts the prefix,value-pairs in elements into trie.

This always uses an exact match for prefix, updating its value if it exists.

Example

iex> ipt = new()
...> |> put([{"1.1.1.0/24", 0}, {"1.1.1.1", 0}, {"1.1.1.1", "x"}])
iex>
iex> get(ipt, "1.1.1.1")
{"1.1.1.1", "x"}
Link to this function

put(trie, prefix, value)

View Source

Specs

put(t(), prefix(), any()) :: t()

Puts value under prefix in trie.

This always uses an exact match for prefix, replacing its value if it exists.

Example

iex> ipt = new()
...> |> put("1.1.1.0/24", 0)
...> |> put("1.1.1.1", 1)
...> |> put("1.1.1.1", "x")
iex>
iex> get(ipt, "1.1.1.1")
{"1.1.1.1", "x"}