pub fn print_table_data(&self) {
        let mut print_table = PrintTable::new();

        let column_names = self
            .columns
            .iter()
            .map(|col| col.column_name.to_string())
            .collect::<Vec<String>>();

        let header_row = PrintRow::new(
            column_names
                .iter()
                .map(|col| PrintCell::new(&col))
                .collect::<Vec<PrintCell>>(),
        );

        let rows_clone = Rc::clone(&self.rows);
        let row_data = rows_clone.as_ref().borrow();
        let first_col_data = row_data.get(&self.columns.first().unwrap().column_name).unwrap();
        let num_rows = first_col_data.count();
        let mut print_table_rows: Vec<PrintRow> = vec![PrintRow::new(vec![]); num_rows];

        for col_name in &column_names {
            let col_val = row_data
                .get(col_name)
                .expect("Can't find any rows with the given column");
            let columns: Vec<String> = col_val.get_serialized_col_data();

            for i in 0..num_rows {
                if let Some(cell) = &columns.get(i){
                    print_table_rows[i].add_cell(PrintCell::new(cell));
                }else{
                    print_table_rows[i].add_cell(PrintCell::new("")); 
                }                
            }
        }

        print_table.add_row(header_row);
        for row in print_table_rows {
            print_table.add_row(row);
        }

        print_table.printstd();
    }
/// Print the table data to standard output in a pretty formatted way
///
/// # Example
/// 
/// ```
/// let db_table = db.get_table_mut(table_name.to_string()).unwrap();
/// db_table.print_table_data();
/// 
/// Prints to standard output:
///     +----+---------+------------------------+
///     | id | name    | email                  |
///     +----+---------+------------------------+
///     | 1  | "Jack"  | "jack@mail.com"        |
///     +----+---------+------------------------+
///     | 10 | "Bob"   | "bob@main.com"         |
///     +----+---------+------------------------+
///     | 11 | "Bill"  | "bill@main.com"        |
///     +----+---------+------------------------+
/// ```
///
Print the table data to standard output in a pretty formatted way
Print the table data to standard output in a pretty formatted way
pub fn print_table_data(&self) {
        let mut print_table = PrintTable::new();
        let column_names = self
            .columns
            .iter()
            .map(|col| col.column_name.to_string())
            .collect::<Vec<String>>();
        let header_row = PrintRow::new(
            column_names
                .iter()
                .map(|col| PrintCell::new(&col))
                .collect::<Vec<PrintCell>>(),
        );
        let rows_clone = Rc::clone(&self.rows);
        let row_data = rows_clone.as_ref().borrow();
        let first_col_data = row_data.get(&self.columns.first().unwrap().column_name).unwrap();
        let num_rows = first_col_data.count();
        let mut print_table_rows: Vec<PrintRow> = vec![PrintRow::new(vec![]); num_rows];
        for col_name in &column_names {
            let col_val = row_data
                .get(col_name)
                .expect("Can't find any rows with the given column");
            let columns: Vec<String> = col_val.get_serialized_col_data();
            for i in 0..num_rows {
                if let Some(cell) = &columns.get(i){
                    print_table_rows[i].add_cell(PrintCell::new(cell));
                }else{
                    print_table_rows[i].add_cell(PrintCell::new("")); 
                }                
            }
        }
        print_table.add_row(header_row);
        for row in print_table_rows {
            print_table.add_row(row);
        }
        print_table.printstd();
    }
pub fn print_table_data ( & self ) { let mut print_table = PrintTable :: new ( ) ; let column_names = self . columns . iter ( ) . map ( | col | col . column_name . to_string ( ) ) . collect :: < Vec < String > > ( ) ; let header_row = PrintRow :: new ( column_names . iter ( ) . map ( | col | PrintCell :: new ( & col ) ) . collect :: < Vec < PrintCell > > ( ) , ) ; let rows_clone = Rc :: clone ( & self . rows ) ; let row_data = rows_clone . as_ref ( ) . borrow ( ) ; let first_col_data = row_data . get ( & self . columns . first ( ) . unwrap ( ) . column_name ) . unwrap ( ) ; let num_rows = first_col_data . count ( ) ; let mut print_table_rows : Vec < PrintRow > = vec ! [ PrintRow new ( vec [ ] ) num_rows ] ; for col_name in & column_names { let col_val = row_data . get ( col_name ) . expect ( " " ) ; let columns : Vec < String > = col_val . get_serialized_col_data ( ) ; for i in 0 .. num_rows { if let Some ( cell ) = & columns . get ( i ) { print_table_rows [ i ] . add_cell ( PrintCell :: new ( cell ) ) ; } else { print_table_rows [ i ] . add_cell ( PrintCell :: new ( " " ) ) ; } } } print_table . add_row ( header_row ) ; for row in print_table_rows { print_table . add_row ( row ) ; } print_table . printstd ( ) ; }
Print the table data to standard output in a pretty formatted way
Print the table data to standard output in a pretty formatted way
&self
&self
example
```
let db_table = db.get_table_mut(table_name.to_string()).unwrap();
db_table.print_table_data().


` ` ` let db_table = db . get_table_mut ( table_name . to_string () ) . unwrap () ; db_table . print_table_data () .