Open desaikd opened 8 months ago
So, that is why I mentioned
WriteAsIon
in one of my other comments.WriteAsIon
is already implemented for primitive types and forVec<T: WriteAsIon>
, and if we don't have an equivalentReadFromIon
or similar, then we need to create an issue for that inion-rust
.On the other hand, I think there could also be reason to use wrapper if we want to add additional validation constraints, such as
type::{ name: small_int, type: int, valid_values: range::[0, 9] }
. In that case havingstruct SmallInt(u8)
would actually allow us to add the range check to the type. That being said, I can't remember if we decided whether we want to ever have additional validations like that.
https://github.com/amazon-ion/ion-cli/pull/90#discussion_r1533061185
Currently
struct.templ
has if statements that help render a Ruststruct
based onAbstractDataType
value. Instead generate different modules for ease of code maintenance and reviewer's readability.