oli-obk / priroda

A graphical debugger for Rust MIR
Apache License 2.0
183 stars 13 forks source link

Remove rental #35

Closed DJMcNab closed 3 years ago

DJMcNab commented 3 years ago

Fixes #30

The approach I've taken here is basically a brute force approach - we reconstruct the Vec<Style, &str> from the file contents when we need it. We construct the Range<usize> manually rather than using HighlightRangeIter, because the API of HighlightRangeIter means we need to do a lot manual plumbing outselves.

CC @trishume

It's worth noting that the file never changes between the times we are rehighlighting - it's only the HTML we need to regenerate, because our only change is adding a lightcoral (#f08080) background on the currently active text.