I'm trying to deserialize an enum like this:
#[derive(Deserialize)]
struct Unit;
#[derive(Deserialize)]
enum Enum {
Tuple(u32, u32),
Struct { x: u32 },
UnitLike,
Wrap(Unit),
}
While the first three variants work without problems, I can't find a lua representation for Wrap(Unit):
let _enum: Vec<Enum> = lua.from_value(
lua.load(
r#"
{
{ Tuple = { 3, 4 } },
{ Struct = { x = 5 } },
"UnitLike",
-- "Wrap", -- doesn't work
-- { Wrap = "Unit" }, -- doesn't work
}
"#,
)
.eval()?,
)?;