Open The-Minecraft-Scientist opened 1 week ago
I realized after the fact that I can simply impl<'a> SpanContents<'a> for &'a MyOwnedSpanContents
, which solves most of my issues.
edit: it didn't
Reopening because that impl that "solved things" only pushed the issues I encountered up into the implementation of SourceCode
I have a scenario where source bytes for my custom SpanContents are potentially dynamically generated by each call to
read_span
on my source code, returning anArc<str>
(which is then stored in my SpanContents), and it would be very helpful to be able to return an opaque, possibly-owned value instead of&'a [u8]
(something along the lines ofimpl AsRef<[u8]> + 'a
) edit 1 :impl AsRef<[u8]> + 'a
breaks object safety (duh), looking for an alternative