// Populate stack_counts based on lines from the reader and returns the sum of the sample counts.
Populate stack_counts based on lines from the reader and returns the sum of the sample counts.
Populate stack_counts based on lines from the reader and returns the sum of the sample counts .
fn parse_stack_counts<R>(
    opt: Options,
    stack_counts: &mut FnvHashMap<String, Counts>,
    mut reader: R,
    is_first: bool,
) -> io::Result<usize>
where
    R: BufRead,
{
    let mut total = 0;
    let mut line = String::new();
    let mut stripped_fractional_samples = false;
    loop {
        line.clear();
        if reader.read_line(&mut line)? == 0 {
            break;
        }
        if let Some((stack, count)) =
            parse_line(&line, opt.strip_hex, &mut stripped_fractional_samples)
        {
            let mut counts = stack_counts.entry(stack).or_default();
            if is_first {
                counts.first += count;
            } else {
                counts.second += count;
            }
            total += count;
        } else {
            warn!("Unable to parse line: {}", line);
        }
    }
    Ok(total)
}
fn parse_stack_counts < R > ( opt : Options , stack_counts : & mut FnvHashMap < String , Counts > , mut reader : R , is_first : bool , ) -> io :: Result < usize > where R : BufRead , { let mut total = 0 ; let mut line = String :: new ( ) ; let mut stripped_fractional_samples = false ; loop { line . clear ( ) ; if reader . read_line ( & mut line ) ? == 0 { break ; } if let Some ( ( stack , count ) ) = parse_line ( & line , opt . strip_hex , & mut stripped_fractional_samples ) { let mut counts = stack_counts . entry ( stack ) . or_default ( ) ; if is_first { counts . first += count ; } else { counts . second += count ; } total += count ; } else { warn ! ( " " line ) ; } } Ok ( total ) }
Populate stack_counts based on lines from the reader and returns the sum of the sample counts.
Populate stack_counts based on lines from the reader and returns the sum of the sample counts .
opt
Options
stack_counts
&mut FnvHashMap<String, Counts>
reader
R
is_first
bool