Closed SabrinaJewson closed 1 year ago
That’s true — I was motivated to make this PR by the fact that it does require some unsafe
code that is non-trivial to get right. The thing to me is that the majority of cases where people would benefit from this method they’ll end up using .alloc_str(&format!
instead which is much slower — on the other hand, if this method is supported they’ll just have faster code. So to me it feels more like an optimization in this library, rather than just additional API surface.
Thanks for opening this PR, but after some consideration I don't think it belongs here.
I thought this would be a useful function to have. The motivation behind the
&impl AsRef<str>
design is that it greatly simplifies the implementation in comparison toimpl AsRef<str>
(see the previous commit) — also, as the iterator is iterated twice users should be producing references anyway.