Closed shahn closed 1 month ago
Sounds good! We should add this to the compiler config, though. The generated bindings are quite large already now, so any code generation beyond the bare minimum should be optional. Just to make sure I understand your use case:
MessageType ::= CHOICE {
text OCTET STRING,
codedNumeric INTEGER
}
would generate
// ...
impl From<OctetString> for MessageType {
// ...
}
impl From<Integer> for MessageType {
// ...
}
Thank you for the suggestion, I'd be happy to review a PR.
Yes, the idea is exactly what you described. I will work on a PR and come back, might be a little while.
The format I am working with uses CHOICE quite a bit and it would be nice to be able to go from the inner type to the container. Perhaps a From impl for this could be auto-generated? I would be happy to take a stab at it, if it is deemed acceptable.