Iptrie.count

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

Specs

count(t()) :: non_neg_integer()

Returns the number of prefix,value-pairs in given trie.

Note that this requires traversal of radix tree(s) present in trie.

Example

iex> t = new([{"1.1.1.1", 1}, {"acdc::", 2}])
iex> count(t)
2

Specs

count(t(), type()) :: non_neg_integer()

Returns the number of prefix,value-pairs for given type in trie.

If trie has no radix tree of given type, 0 is returned. Use Iptrie.has_type?/2 to check if a trie holds a given type.

Example

iex> t = new([{"1.1.1.1", 1}, {"acdc::", 2}])
iex> count(t, 32)
1
iex> count(t, 128)
1
iex> types(t)
...> |> Enum.map(fn type -> {type, count(t, type)} end)
[{32, 1}, {128, 1}]