Crate enum_compatability_macro

source ·
Expand description

A macro to document enum variants with the things that they are compatible with.

As well as documenting each variant, this macro also generates lists of all compatible variants for each “thing”.

§Motivation

This macro is used in Conjure-Oxide, a constraint modelling tool with support for multiple backend solvers (e.g. Minion, SAT).

The Conjure-Oxide AST is used as the singular representation for constraints models throughout its crate. A consequence of this is that the AST must contain all possible supported expressions for all solvers, as well as the high level Essence language it takes as input. Therefore, only a small subset of AST nodes are useful for a particular solver.

The documentation this generates helps rewrite rule implementers determine which AST nodes are used for which backends by grouping AST nodes per solver.

Attribute Macros§