pub fn write_spans(writer: impl Write, spans: Vec<Span>) -> Result<()>
Expand description
Dump flame spans to a writer, e.g. a file, specifying the spans you want to write.
flamescope::write_spans(
&mut File::create("flamescope.json").unwrap(),
// if you wanted only every other span, for some reason.
flame::spans()
.into_iter()
.enumerate()
.filter(|(i, _)| i % 2 == 0)
.map(|(_, span)| span)
.collect(),
).unwrap();