Thank you again for adding the data type maps, it really helps! I do have a question though, what data type should I use to express XDR C-like enums?
I thought that I could just make them c-like and it would work:
https://github.com/kbacha/clike-xdr-enums/blob/cd9995d0e8fbd317316e51be132f4ba5749f3f7e/src/main.rs#L5-L17
My thought was that the discriminant value of the enum could be used, but instead it was the ordinal position that was used:
$ cargo run
Compiling test_serde_xdr v0.1.0 (file:///Users/kchoubacha/repos/kbacha/test_serde_xdr)
Finished dev [unoptimized + debuginfo] target(s) in 0.53 secs
Running `target/debug/test_serde_xdr`
Ok([0, 0, 0, 0])
Ok([0, 0, 0, 1])
One thing that I noticed when playing with enums in rust is that if the enum is all void types, then it's coercible to a i32. Possibly these values could be used as the discriminant then?
Another possibility is a serde derive attribute to set the discriminant value.
Thoughts?
Thank you again for adding the data type maps, it really helps! I do have a question though, what data type should I use to express XDR C-like enums?
I thought that I could just make them c-like and it would work:
https://github.com/kbacha/clike-xdr-enums/blob/cd9995d0e8fbd317316e51be132f4ba5749f3f7e/src/main.rs#L5-L17
My thought was that the discriminant value of the enum could be used, but instead it was the ordinal position that was used:
One thing that I noticed when playing with enums in rust is that if the enum is all void types, then it's coercible to a i32. Possibly these values could be used as the discriminant then?
Another possibility is a serde derive attribute to set the discriminant value.
Thoughts?