/// Returns the structured scorecard information for display on the terminal
///
/// # Arguments
///
/// * `scorecard` - A slice of all the innings information in a match
Returns the structured scorecard information for display on the terminal
Returns the structured scorecard information for display on the terminal
fn format_scorecard_info(scorecard: &[MatchInningsInfo]) -> Vec<Spans> {
    let mut text = vec![];
    for (ino, info) in scorecard.iter().enumerate().rev() {
        text.push(Spans::from(Span::styled(
            format!("Innings {}", ino + 1),
            Style::default().add_modifier(Modifier::BOLD | Modifier::UNDERLINED),
        )));
        text.push(Spans::from(""));
        text.push(Spans::from(Span::styled(
            format!(
                "{:<30} {:<60} {:<3} {:<3} {:<2} {:<2} {:<6}",
                "Batsman", "", "R", "B", "4s", "6s", "SR"
            ),
            Style::default().add_modifier(Modifier::BOLD),
        )));
        for b in &info.batsman_details {
            text.push(Spans::from(format!(
                "{:<30} {:<60} {:<3} {:<3} {:<2} {:<2} {:<6}",
                b.name, b.status, b.runs, b.balls, b.fours, b.sixes, b.strike_rate
            )));
        }
        text.push(Spans::from(""));
        text.push(Spans::from(Span::styled(
            format!(
                "{:<30} {:<5} {:<3} {:<3} {:<2} {:<2} {:<2} {:<6}",
                "Bowler", "O", "M", "R", "W", "NB", "WD", "ECO"
            ),
            Style::default().add_modifier(Modifier::BOLD),
        )));
        for b in &info.bowler_details {
            text.push(Spans::from(format!(
                "{:<30} {:<5} {:<3} {:<3} {:<2} {:<2} {:<2} {:<6}",
                b.name, b.overs, b.maidens, b.runs, b.wickets, b.no_balls, b.wides, b.economy
            )));
        }
        text.push(Spans::from(""));
    }
    text
}
fn format_scorecard_info ( scorecard : & [ MatchInningsInfo ] ) -> Vec < Spans > { let mut text = vec ! [ ] ; for ( ino , info ) in scorecard . iter ( ) . enumerate ( ) . rev ( ) { text . push ( Spans :: from ( Span :: styled ( format ! ( " " ino 1 ) , Style :: default ( ) . add_modifier ( Modifier :: BOLD | Modifier :: UNDERLINED ) , ) ) ) ; text . push ( Spans :: from ( " " ) ) ; text . push ( Spans :: from ( Span :: styled ( format ! ( " " " " " " " " " " " " " " " " ) , Style :: default ( ) . add_modifier ( Modifier :: BOLD ) , ) ) ) ; for b in & info . batsman_details { text . push ( Spans :: from ( format ! ( " " b name b status b runs b balls b fours b sixes b strike_rate ) ) ) ; } text . push ( Spans :: from ( " " ) ) ; text . push ( Spans :: from ( Span :: styled ( format ! ( " " " " " " " " " " " " " " " " " " ) , Style :: default ( ) . add_modifier ( Modifier :: BOLD ) , ) ) ) ; for b in & info . bowler_details { text . push ( Spans :: from ( format ! ( " " b name b overs b maidens b runs b wickets b no_balls b wides b economy ) ) ) ; } text . push ( Spans :: from ( " " ) ) ; } text }
Returns the structured scorecard information for display on the terminal
Returns the structured scorecard information for display on the terminal
scorecard
&[MatchInningsInfo]