Missing comma after `${vdefbody}` for braced variant
According to the reference, for a braced variant ${vdefbody VNAME FIELDS}
produces VNAME { FIELDS }
.
This is incorrect; there should be a comma after it. (When you're defining an enum, you need a comma after each variant.)
Example:
pub use derive_deftly;
use derive_deftly::{define_derive_deftly,Deftly};
define_derive_deftly! {
pub Copied =
// (This is copied from the reference)
$tvis $tdefkwd $<$tname Copy><$tdefgens>
${tdefvariants $(
${vdefbody $<$vname Copy> $(
$fdefvis ${fdefine $<$fname _copy>} $ftype,
) }
) }
}
// This compiles happily, since B is the last variant.
#[derive(Deftly)]
#[derive_deftly(Copied)]
pub enum MyEnum1 {
A,
B { x: u32 },
}
// This does not compile, since there is a missing comma after B.
#[derive(Deftly)]
#[derive_deftly(Copied)]
pub enum MyEnum2 {
B { x: u32 },
A,
}