fn build_header(cols: usize, op: &str, name: &str, status: Option<impl AsRef<str>>) -> Table {
    let mut header = if let Some(status) = status {
        let mut name_table = table!([
            " Name: ",
            format!("{:1$}", textwrap::fill(name.as_ref(), cols - 68), cols - 68),
        ]);

        name_table.set_format(format_none());
        table!([
            format!(
                "Op: {:15}",
                if op.starts_with("Unimplemented(") {
                    Red.bold().paint(op)
                } else {
                    Blue.bold().paint(op)
                }
            ),
            name_table,
            Style::new().bold().paint(format!(" {:^33}", status.as_ref())),
        ])
    } else {
        let mut name_table = table!([
            " Name: ",
            format!("{:1$}", textwrap::fill(name.as_ref(), cols - 46), cols - 46),
        ]);

        name_table.set_format(format_none());
        table!([format!("Operation: {:15}", Blue.bold().paint(op)), name_table])
    };

    header.set_format(format_only_columns());
    table![[header]]
}
/// Builds a box header containing the operation, name and status on the same line.
Builds a box header containing the operation, name and status on the same line.
Builds a box header containing the operation name and status on the same line .
fn build_header(cols: usize, op: &str, name: &str, status: Option<impl AsRef<str>>) -> Table {
    let mut header = if let Some(status) = status {
        let mut name_table = table!([
            " Name: ",
            format!("{:1$}", textwrap::fill(name.as_ref(), cols - 68), cols - 68),
        ]);
        name_table.set_format(format_none());
        table!([
            format!(
                "Op: {:15}",
                if op.starts_with("Unimplemented(") {
                    Red.bold().paint(op)
                } else {
                    Blue.bold().paint(op)
                }
            ),
            name_table,
            Style::new().bold().paint(format!(" {:^33}", status.as_ref())),
        ])
    } else {
        let mut name_table = table!([
            " Name: ",
            format!("{:1$}", textwrap::fill(name.as_ref(), cols - 46), cols - 46),
        ]);
        name_table.set_format(format_none());
        table!([format!("Operation: {:15}", Blue.bold().paint(op)), name_table])
    };
    header.set_format(format_only_columns());
    table![[header]]
}
fn build_header ( cols : usize , op : & str , name : & str , status : Option < impl AsRef < str > > ) -> Table { let mut header = if let Some ( status ) = status { let mut name_table = table ! ( [ " " format ( " " textwrap fill ( name as_ref ( ) cols 68 ) cols 68 ) ] ) ; name_table . set_format ( format_none ( ) ) ; table ! ( [ format ( " " if op starts_with ( " " ) { Red bold ( ) paint ( op ) } else { Blue bold ( ) paint ( op ) } ) name_table Style new ( ) bold ( ) paint ( format ( " " status as_ref ( ) ) ) ] ) } else { let mut name_table = table ! ( [ " " format ( " " textwrap fill ( name as_ref ( ) cols 46 ) cols 46 ) ] ) ; name_table . set_format ( format_none ( ) ) ; table ! ( [ format ( " " Blue bold ( ) paint ( op ) ) name_table ] ) } ; header . set_format ( format_only_columns ( ) ) ; table ! [ [ header ] ] }
Builds a box header containing the operation, name and status on the same line.
Builds a box header containing the operation name and status on the same line .
cols
usize
op
&str
name
&str
status
Option<impl AsRef<str>>
cols
usize
op
&str
name
&str
status
Option<impl AsRef<str>>