I have a JavaScript object type where the kind
field determines what other fields are present. Examples:
{ kind: 0, name: "foo" }
{ kind: 1, name: "foo", value: 69 }
{ kind: 2 }
I have a Rust function that takes this value from JavaScript and it needs to do pattern matching on this value. What's the best way to do this?