PhoenixGenApi.ImplHelper (PhoenixGenApi v2.7.0)

Copy Markdown View Source

Summary

Functions

Macro to generate simple implementation of protocol. Support for easy to use with general encoder.

Functions

__using__(opts)

(macro)

Macro to generate simple implementation of protocol. Support for easy to use with general encoder.

Utility macro to generate implementation for struct.

The target struct must have encode!/2 function in module.

Usage:

use PhoenixGenApi.ImplHelper, encoder: JSON.Encoder, impl: [AModule1, AModule2, ...]

Using macro without option in use keyword. Target module must have encode!/2 function Generate implementation from struct for JSON.Encoder like this:

require PhoenixGenApi.ImplHelper

gen_impl JSON.Encoder, AModule

gen_impl(encoder, module)

(macro)