• Turn a TLV class into a field type, where the TLV is nested inside the field.

    Type Parameters

    Parameters

    Returns StructFieldType<T>

    Example

    Given this structure:

    Outer = OUTER-TYPE TLV-LENGTH Middle
    Middle = MIDDLE-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.Middle, "inner", StructFieldType.nest(Inner));

    Inner type does not have to encode itself as a TLV. Its encoding result appears as the TLV-VALUE of the "middle" field TLV.