Closed Earthmark closed 2 weeks ago
Thanks a lot! Just came back from vacation, give me a few more days to get back into this.
Any updates on this?
Apologies for the delay, the short summer just started here for real :)
This looks good. It would be interesting to see if return values could be made compatible with spans as well, e.g., if the type happened to be compatible with out Slice type, or if that can be done on rval wrapping.
The hope being this provides support for more exotic memory structures.
This is not behind a version check because it's an explicit option, and it will panic if span is selected but unsafe code support is not.
I'm not sure a good way to require this without a larger API change, and my goal was to make this a small opt-in feature.
Originally I was planning to have it generate overload methods, but if a consumer is using unsafe code and wants to use spans, all signatures will still work with arrays just as well. That code also needed guards to ensure it wouldn't generate duplicates of methods that didn't use spans, which added a lot of complexity.