ToonEx.Btoon.ImplHelper (toon_ex v1.3.1)

Copy Markdown View Source

Helper macro for generating ToonEx.Btoon.Encoder protocol implementations.

Allows modules to easily implement the ToonEx.Btoon.Encoder protocol by providing a list of modules that have an encode! function. Mirrors ToonEx.Btoon.ImplHelper for the TOON text encoder, but targets the BTOON binary ToonEx.Btoon.Encoder protocol instead.

Usage

The target struct must have an encode! function for real encoding of the struct data to BTOON in the module, returning a BTOON-encodable term (such as a map with string keys):

use ToonEx.Btoon.ImplHelper, impl: [AModule1, AModule2, ...]

or directly:

ToonEx.Btoon.ImplHelper.gen_impl AModule

Summary

Functions

gen_impl(mod)

(macro)