Support IntoIterator<Item = String> in flamegraph::from_lines
itamarst opened this issue · comments
Right now this API takes IntoIterator<Item = &'a str>
and it's a pain to turn IntoIterator<Item = String>
into the former. Googling suggests the solution is accepting IntoIterator<Item = AsRef<str>>
, which should be backwards compatible?
Unfortunately this is harder than it sounds — we specifically need to get string references with a 'a
lifetime in the methods in question so that we don't have to re-allocate and copy every string argument we're given. Notice how the code also uses 'a
for the other arguments here:
inferno/src/flamegraph/merge.rs
Lines 28 to 29 in 74f2fb0
It would be nice to make the API work in such a way that the whole input doesn't need to be kept allocated across the runtime of the analysis, but it would require some deeper changes I think.