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 an Arc<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 of impl AsRef<[u8]> + 'a)
edit 1 : impl AsRef<[u8]> + 'a breaks object safety (duh), looking for an alternative
returning owned data from SpanContents::data #410
Open
opened 2024年11月22日 06:14:57 +01:00 by Random-Scientist
·
2 comments
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 an `Arc<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 of `impl AsRef<[u8]> + 'a`)
edit 1 : `impl AsRef<[u8]> + 'a` breaks object safety (duh), looking for an alternative
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
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
Reopening because that impl that "solved things" only pushed the issues I encountered up into the implementation of `SourceCode`
Sign in to join this conversation.
No Branch/Tag specified
main
zkat/typed-report
v7.6.0
miette-derive-v7.6.0
v7.4.0
miette-derive-v7.4.0
v7.3.0
miette-derive-v7.3.0
v7.2.0
miette-derive-v7.2.0
miette-derive-v7.1.0
v7.1.0
miette-derive-v7.0.0
v7.0.0
miette-derive-v6.0.1
v6.0.1
miette-derive-v6.0.0
v6.0.0
miette-derive-v5.10.0
v5.10.0
miette-derive-v5.9.0
v5.9.0
miette-derive-v5.8.0
v5.8.0
miette-derive-v5.7.0
v5.7.0
miette-derive-v5.6.0
v5.6.0
miette-derive-v5.5.0
v5.5.0
miette-derive-v5.4.1
v5.4.1
miette-derive-v5.4.0
v5.4.0
miette-derive-v5.3.1
v5.3.1
miette-derive-v5.3.0
v5.3.0
v5.2.0
miette-derive-v5.2.0
miette-derive-v5.1.1
v5.1.1
miette-derive-v5.1.0
v5.1.0
miette-derive-v5.0.0
v5.0.0
miette-derive-v4.7.1
v4.7.1
miette-derive-v4.7.0
v4.7.0
miette-derive-v4.6.0
v4.6.0
miette-derive-v4.5.0
v4.5.0
miette-derive-v4.4.0
v4.4.0
miette-derive-v4.3.0
v4.3.0
v4.2.1
v4.2.0
v4.1.0
v4.0.1
miette-derive-v4.0.0
v4.0.0
miette-derive-v3.3.0
v3.3.0
miette-derive-v3.2.0
v3.2.0
v3.1.0
v3.0.1
v3.0.0
v3.0.0-beta.0
v3.0.0-alpha.0
miette-derive-v2.2.0
v2.2.0
miette-derive-v2.1.2
v2.1.2
v2.1.1
v2.1.0
v2.0.0
miette-derive-v2.0.0
v1.1.0
1.0.1
1.0.0
1.0.0-beta.1
0.13.0
0.12.0
0.11.0
0.10.0
0.9.0
0.8.1
0.8.0
0.7.0
0.6.0
0.5.0
0.4.0
0.3.1
0.3.0
0.2.1
0.2.0
0.1.0
Labels
Clear labels
breaking
A semver-major breaking change
bug
Something isn't working
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
epic
Tracking issue for other issues.
good first issue
Good for newcomers
Hacktoberfest
Stuff that's good for hacktoberfest contribs
help wanted
Extra attention is needed
invalid
This doesn't seem right
question
Further information is requested
wontfix
This will not be worked on
No labels
breaking
bug
documentation
duplicate
enhancement
epic
good first issue
Hacktoberfest
help wanted
invalid
question
wontfix
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
zkat/miette#410
Loading...
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?