You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is generally applicable to ion-rs as well, but as we design the traits we want to have for our APIs, we should be consider how Generic Associated Traits (GAT) can be used to make our APIs reasonably flexible while maintaining static polymorphism.
Currently, delegation via our current APIs are difficult because we cannot have an associated type that can be constructed with a per invocation lifetime. This example illustrates this, and shows how we can work around this by the judicious use of unsafe code, by essentially emulating the reference with pointers we know to be scoped appropriately. We also work around the lack of GAT by simplifying the value writer used in the implementation of IonCAnnotationsFieldWriter for IonCWriterHandle by refering to Self which works, but makes the API potentially easier to misuse.
The text was updated successfully, but these errors were encountered:
This is generally applicable to
ion-rs
as well, but as we design the traits we want to have for our APIs, we should be consider how Generic Associated Traits (GAT) can be used to make our APIs reasonably flexible while maintaining static polymorphism.Currently, delegation via our current APIs are difficult because we cannot have an associated type that can be constructed with a per invocation lifetime. This example illustrates this, and shows how we can work around this by the judicious use of
unsafe
code, by essentially emulating the reference with pointers we know to be scoped appropriately. We also work around the lack of GAT by simplifying the value writer used in the implementation ofIonCAnnotationsFieldWriter
forIonCWriterHandle
by refering toSelf
which works, but makes the API potentially easier to misuse.The text was updated successfully, but these errors were encountered: