ralexstokes / ssz-rs

Implementation of ethereum's `ssz`
Apache License 2.0
103 stars 41 forks source link

Support "transparent" attribute of `ssz-rs-derive` for generalized index computation #135

Closed ralexstokes closed 7 months ago

ralexstokes commented 7 months ago

This is currently not implemented. It may be helpful at some point in the future.

ralexstokes commented 7 months ago

After investigating this, the "transparent" mode of operation cannot be supported for the GeneralizedIndexable trait. This is because this trait works at the type-level, and so there is no instance-level data to supply to navigate a wrapper enum (which this proc macro supports).

All of the methods of GeneralizedIndexable would have to be extended to take a reference to self which seems a bit heavy just to support this one mode of this proc macro.

Instead, users of a "transparent" wrapper enum will need to just manually implement some function to compute generalized indices (i.e. just inspect which variant we have and then proxy to the (likely derived) methods on the instance.

Closing this as no intent to support.