fn display_table<T>(&self, list: &T, indent: bool)
    where
        T: TableOutputHandler,
    {
        let header = list.header();
        let content = list.content();

        // if table is empty, return
        if content.is_empty() {
            return;
        }

        // Create the table
        let mut table = Table::new();
        let mut format = *format::consts::FORMAT_CLEAN;
        let pad_left = if indent { 5 } else { 1 };
        format.padding(pad_left, 1);
        table.set_format(format);

        // add header
        table.set_titles(header);

        // add rows
        for row in content {
            table.add_row(row);
        }

        // print table to stdout
        table.printstd();
    }
/// convert result to table output and print to screen
convert result to table output and print to screen
convert result to table output and print to screen
fn display_table<T>(&self, list: &T, indent: bool)
    where
        T: TableOutputHandler,
    {
        let header = list.header();
        let content = list.content();
        // if table is empty, return
        if content.is_empty() {
            return;
        }
        // Create the table
        let mut table = Table::new();
        let mut format = *format::consts::FORMAT_CLEAN;
        let pad_left = if indent { 5 } else { 1 };
        format.padding(pad_left, 1);
        table.set_format(format);
        // add header
        table.set_titles(header);
        // add rows
        for row in content {
            table.add_row(row);
        }
        // print table to stdout
        table.printstd();
    }
fn display_table < T > ( & self , list : & T , indent : bool ) where T : TableOutputHandler , { let header = list . header ( ) ; let content = list . content ( ) ; // if table is empty, return if content . is_empty ( ) { return ; } // Create the table let mut table = Table :: new ( ) ; let mut format = * format :: consts :: FORMAT_CLEAN ; let pad_left = if indent { 5 } else { 1 } ; format . padding ( pad_left , 1 ) ; table . set_format ( format ) ; // add header table . set_titles ( header ) ; // add rows for row in content { table . add_row ( row ) ; } // print table to stdout table . printstd ( ) ; }
convert result to table output and print to screen
convert result to table output and print to screen
&self
list
&T
indent
bool
&self
list
&T
indent
bool