View Source Wafer.Release protocol (wafer v1.1.0)

A protocol for releasing connections. The opposite of Conn's acquire/1.

Deriving

If you're implementing your own Conn type that simply delegates to one of the lower level drivers that you can derive this protocol automatically:

defstruct MyConn do
  @derive Wafer.Release
  defstruct [:conn]
end

If your type uses a key other than conn for the inner connection you can specify it while deriving:

defstruct MyConn do
  @derive {Wafer.Release, key: :pin_conn}
  defstruct [:pin_conn]
end

Summary

Types

t()

All the types that implement this protocol.

Functions

Release all resources associated with the connection. Usually in preparation for shutdown.

Types

@type t() :: term()

All the types that implement this protocol.

Functions

@spec release(Wafer.Conn.t()) :: :ok | {:error, any()}

Release all resources associated with the connection. Usually in preparation for shutdown.