File: impl.ex

package info (click to toggle)
erlang-hex 2.0.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,204 kB
  • sloc: erlang: 2,950; sh: 203; makefile: 10
file content (40 lines) | stat: -rw-r--r-- 1,209 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Vendored from hex_solver v0.2.2 (2634e31), do not edit manually

defmodule Hex.Solver.Constraints.Impl do
  @moduledoc false

  defmacro __using__(opts) do
    for = Keyword.get(opts, :for, __CALLER__.module)

    quote do
      defimpl Hex.Solver.Constraint, for: unquote(for) do
        def any?(constraint),
          do: unquote(__CALLER__.module).any?(constraint)

        def empty?(constraint),
          do: unquote(__CALLER__.module).empty?(constraint)

        def allows?(constraint, version),
          do: unquote(__CALLER__.module).allows?(constraint, version)

        def allows_any?(left, right),
          do: unquote(__CALLER__.module).allows_any?(left, right)

        def allows_all?(left, right),
          do: unquote(__CALLER__.module).allows_all?(left, right)

        def difference(left, right),
          do: unquote(__CALLER__.module).difference(left, right)

        def intersect(left, right),
          do: unquote(__CALLER__.module).intersect(left, right)

        def union(left, right),
          do: unquote(__CALLER__.module).union(left, right)

        def compare(left, right),
          do: unquote(__CALLER__.module).compare(left, right)
      end
    end
  end
end