View Source Moar.Protocol (Moar v1.6.0)

Protocol-related functions.

Link to this section Summary

Functions

Returns x or raises if x does not implment protocol.

Returns true if x implements protocol.

Link to this section Functions

Link to this function

implements!(x, protocol)

View Source
@spec implements!(any(), module()) :: any()

Returns x or raises if x does not implment protocol.

iex> Moar.Protocol.implements!(~D[2000-01-02], String.Chars)
~D[2000-01-02]
Link to this function

implements?(x, protocol)

View Source
@spec implements?(any(), module()) :: boolean()

Returns true if x implements protocol.

iex> Moar.Protocol.implements?(~D[2000-01-02], String.Chars)
true