Open
Description
Given the source
TestDefs { joint-iso-itu-t 1 3 6 1 4 1 33827 1 }
DEFINITIONS ::=
BEGIN
SeqA ::= SEQUENCE {
aa [1] INTEGER,
ab [2] INTEGER
}
SeqB ::= SEQUENCE {
ba [3] INTEGER,
COMPONENTS OF SeqA,
bb [4] INTEGER
}
END
rasn-compiler generates SeqB as
#[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
pub struct SeqB {
#[rasn(tag(context, 3))]
pub ba: Integer,
#[rasn(tag(context, 4))]
pub bb: Integer,
#[rasn(tag(context, 1))]
pub aa: Integer,
#[rasn(tag(context, 2))]
pub ab: Integer,
}
According to X.680-2021,
25.5 "Type" in the "COMPONENTS OF Type" notation shall be a sequence type. The "COMPONENTS OF Type" notation shall be used to define the inclusion, at this point in the list of components, of all the component types (of which there shall be at least one) of the referenced type, except for any extension marker and extension additions that may be present in the "Type".
Therefore, the code that should have been generated is as follows
#[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
pub struct SeqB {
#[rasn(tag(context, 3))]
pub ba: Integer,
#[rasn(tag(context, 1))]
pub aa: Integer,
#[rasn(tag(context, 2))]
pub ab: Integer,
#[rasn(tag(context, 4))]
pub bb: Integer,
}
Metadata
Metadata
Assignees
Labels
No labels