Open XAMPPRocky opened 1 month ago
Thank you for your issue. I was testing this with the following asn1:
IntegerAlias ::= INTEGER (10..14)
FixedSizeAliasSequence ::= SEQUENCE (SIZE (2)) OF IntegerAlias
Which generates the following bindings:
#[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
#[rasn(delegate, size("4"))]
pub struct FixedSizeIntegerSequence(pub [AnonymousFixedSizeIntegerSequence; 4usize]);
#[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
#[rasn(delegate, value("10..=14"))]
pub struct IntegerAlias(pub u8);
However, rasn::Decode
requires for [T; 4]
that T: Default
, so IntegerAlias
would need to implement Default
. I'm reluctant to derive Default
for every type that is used in a fixed size SEQUENCE OF
, because of possible conflicts between the derived rust default value and a hypothetical asn1 DEFAULT
value for the type in a SEQUENCE
or SET
.
Currently the compiler always uses the
SequenceOf
type, but it should use different types if its sizes are restricted. Starting with if it has a fixed size it should use an array.