fn render_ping_frequency<B: Backend>(f: &mut Frame<'_, B>, app: &mut TuiApp, rect: Rect) {
    let target_hop = app.table_state.selected().map_or_else(
        || app.tracer_data().target_hop(),
        |s| &app.tracer_data().hops()[s],
    );
    let freq_data = sample_frequency(target_hop.samples());
    let freq_data_ref: Vec<_> = freq_data.iter().map(|(b, c)| (b.as_str(), *c)).collect();
    let barchart = BarChart::default()
        .block(
            Block::default()
                .title(format!("Frequency #{}", target_hop.ttl()))
                .borders(Borders::ALL)
                .border_type(BorderType::Rounded),
        )
        .data(freq_data_ref.as_slice())
        .bar_width(4)
        .bar_gap(1)
        .bar_style(Style::default().fg(Color::Green))
        .value_style(
            Style::default()
                .bg(Color::Green)
                .add_modifier(Modifier::BOLD),
        );
    f.render_widget(barchart, rect);
}
/// Render a histogram of ping frequencies.
Render a histogram of ping frequencies.
Render a histogram of ping frequencies .
fn render_ping_frequency<B: Backend>(f: &mut Frame<'_, B>, app: &mut TuiApp, rect: Rect) {
    let target_hop = app.table_state.selected().map_or_else(
        || app.tracer_data().target_hop(),
        |s| &app.tracer_data().hops()[s],
    );
    let freq_data = sample_frequency(target_hop.samples());
    let freq_data_ref: Vec<_> = freq_data.iter().map(|(b, c)| (b.as_str(), *c)).collect();
    let barchart = BarChart::default()
        .block(
            Block::default()
                .title(format!("Frequency #{}", target_hop.ttl()))
                .borders(Borders::ALL)
                .border_type(BorderType::Rounded),
        )
        .data(freq_data_ref.as_slice())
        .bar_width(4)
        .bar_gap(1)
        .bar_style(Style::default().fg(Color::Green))
        .value_style(
            Style::default()
                .bg(Color::Green)
                .add_modifier(Modifier::BOLD),
        );
    f.render_widget(barchart, rect);
}
fn render_ping_frequency < B : Backend > ( f : & mut Frame < ' _ , B > , app : & mut TuiApp , rect : Rect ) { let target_hop = app . table_state . selected ( ) . map_or_else ( | | app . tracer_data ( ) . target_hop ( ) , | s | & app . tracer_data ( ) . hops ( ) [ s ] , ) ; let freq_data = sample_frequency ( target_hop . samples ( ) ) ; let freq_data_ref : Vec < _ > = freq_data . iter ( ) . map ( | ( b , c ) | ( b . as_str ( ) , * c ) ) . collect ( ) ; let barchart = BarChart :: default ( ) . block ( Block :: default ( ) . title ( format ! ( " " target_hop ttl ( ) ) ) . borders ( Borders :: ALL ) . border_type ( BorderType :: Rounded ) , ) . data ( freq_data_ref . as_slice ( ) ) . bar_width ( 4 ) . bar_gap ( 1 ) . bar_style ( Style :: default ( ) . fg ( Color :: Green ) ) . value_style ( Style :: default ( ) . bg ( Color :: Green ) . add_modifier ( Modifier :: BOLD ) , ) ; f . render_widget ( barchart , rect ) ; }
Render a histogram of ping frequencies.
Render a histogram of ping frequencies .
f
&mut Frame<'_, B>
app
&mut TuiApp
rect
Rect