1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::{Error, StackedRecord};

/// Reverses stack frames in profile records.
pub fn reverse_stacks<R: StackedRecord>(
    records: impl IntoIterator<Item = Result<R, Error>>,
) -> impl IntoIterator<Item = Result<R, Error>> {
    records.into_iter().map(|record| {
        record.map(|mut record| {
            record.stack_mut().reverse_frames();
            record
        })
    })
}