View Source Rephex.Util (rephex v0.1.1)

Summary

Functions

defmodule BehaviourA do
  @callback foo(any(), any()) :: any()

  @optional_callbacks foo: 2
end

defmodule BehaviourAImpl do
  @behaviour BehaviourA
end

defmodule User do
  def call_foo() do
    {:ok, :but_not_impl} =
      Rephex.Util.call_optional(
        {BehaviourAImpl, :foo, 2},
        [1, 2],
        {:ok, :but_not_impl}
      )
  end
end

Functions

Link to this function

call_optional(mfa, args, default)

View Source
@spec call_optional(mfa :: mfa(), args :: list(), default :: any()) :: any()
defmodule BehaviourA do
  @callback foo(any(), any()) :: any()

  @optional_callbacks foo: 2
end

defmodule BehaviourAImpl do
  @behaviour BehaviourA
end

defmodule User do
  def call_foo() do
    {:ok, :but_not_impl} =
      Rephex.Util.call_optional(
        {BehaviourAImpl, :foo, 2},
        [1, 2],
        {:ok, :but_not_impl}
      )
  end
end
Link to this function

socket_update_in(socket, keys, func)

View Source