Pfx.contrast
You're seeing just the function
contrast
, go back to Pfx module for more information.
Specs
Contrast two Pfx
prefixes
Contrasting two prefixes will yield one of:
:equal
pfx1 is equal to pfx2:more
pfx1 is a more specific version of pfx2:less
pfx1 is a less specific version of pfx2:left
pfx1 is left-adjacent to pfx2:right
pfx1 is right-adjacent to pfx2:disjoint
pfx1 has no match with pfx2 whatsoever.
Examples
iex> contrast(new(<<10, 10>>, 32), new(<<10, 10>>, 32))
:equal
iex> contrast(new(<<10, 10, 10>>, 32), new(<<10, 10>>, 32))
:more
iex> contrast(new(<<10, 10>>, 32), new(<<10, 10, 10>>, 32))
:less
iex> contrast(new(<<10, 10>>, 32), new(<<10, 11>>, 32))
:left
iex> contrast(new(<<10, 11>>, 32), new(<<10, 10>>, 32))
:right
iex> contrast(new(<<10, 10>>, 32), new(<<10, 12>>, 32))
:disjoint
iex> contrast("10.10.0.0/16", %Pfx{bits: <<10,12>>, maxlen: 32})
:disjoint
iex> contrast(%Pfx{bits: <<10, 10, 10>>, maxlen: 32}, {{10, 10, 0, 0}, 16})
:more
iex> contrast("10.10.10.0/24", "10.10.0.0/16")
:more