Given this structure:
Outer = OUTER-TYPE TLV-LENGTH Inner
Inner = INNER-TYPE TLV-LENGTH INNER-VALUE
You can define the Outer
builder:
const buildOuter = new StructBuilder("Outer", TT.Outer)
.add(TT.Inner, "inner", StructFieldType.wrap(Inner));
Inner
type must encode itself as a TLV, and its TLV-TYPE must equal field TLV-TYPE.
Turn a TLV class into a field type, where the TLV directly appears as the field.