Based on our findings in #2136, the incremental path forward, without breaking all lower-level dependencies, is to introduce owned SV2 primitives instead of deprecating the Inner representation of SV2 primitives immediately.
Ideally, in the future, we would like to fully deprecate the Inner representation and instead have distinct Owned and Ref types. This would allow users of binary_sv2 to decide how they want to structure and scope their ADTs, very similar to how serde approaches ownership and borrowing.
With the introduction of owned SV2 primitive types, changes will need to be made across parser_sv2 and the subprotocol crates by introducing owned variants of SV2 messages. Alongside this, the into_static method should be updated to return owned message variants instead of owned variants of Inner binary SV2 constructs.
After that, we can begin migrating sv2-apps to this owned-type framework.
Once the migration has successfully propagated up the stack to sv2-apps, we can start removing the Inner types entirely and replace them with concrete Ref types that can be converted into Owned variants when required.
At a high level, this is essentially a transition from a single Inner type abstraction into separate Ref and Owned representations with explicit ownership semantics.
Based on our findings in #2136, the incremental path forward, without breaking all lower-level dependencies, is to introduce owned SV2 primitives instead of deprecating the
Innerrepresentation of SV2 primitives immediately.Ideally, in the future, we would like to fully deprecate the
Innerrepresentation and instead have distinctOwnedandReftypes. This would allow users ofbinary_sv2to decide how they want to structure and scope their ADTs, very similar to howserdeapproaches ownership and borrowing.With the introduction of owned SV2 primitive types, changes will need to be made across
parser_sv2and the subprotocol crates by introducing owned variants of SV2 messages. Alongside this, theinto_staticmethod should be updated to return owned message variants instead of owned variants ofInnerbinary SV2 constructs.After that, we can begin migrating
sv2-appsto this owned-type framework.Once the migration has successfully propagated up the stack to
sv2-apps, we can start removing theInnertypes entirely and replace them with concreteReftypes that can be converted intoOwnedvariants when required.At a high level, this is essentially a transition from a single
Innertype abstraction into separateRefandOwnedrepresentations with explicit ownership semantics.