fn add_row(&mut self,
               index: usize,
               p: (String, String, String),
               density: &[f64],
               volume: f64,
               distance: f64) {
        let mut row: Vec<String> = Vec::with_capacity(6 + self.density_num);
        row.push(format!("{}", index));
        row.push(p.0);
        row.push(p.1);
        row.push(p.2);
        density.iter().for_each(|d| row.push(format!("{:.6}", d)));
        row.push(format!("{:.6}", volume));
        row.push(format!("{:.6}", distance));
        for (i, col) in row.iter().enumerate() {
            self.column_width[i] = self.column_width[i].max(col.len());
        }
        self.rows.push(row);
    }
/// Adds a row the table.
Adds a row the table.
Adds a row the table .
fn add_row(&mut self,
               index: usize,
               p: (String, String, String),
               density: &[f64],
               volume: f64,
               distance: f64) {
        let mut row: Vec<String> = Vec::with_capacity(6 + self.density_num);
        row.push(format!("{}", index));
        row.push(p.0);
        row.push(p.1);
        row.push(p.2);
        density.iter().for_each(|d| row.push(format!("{:.6}", d)));
        row.push(format!("{:.6}", volume));
        row.push(format!("{:.6}", distance));
        for (i, col) in row.iter().enumerate() {
            self.column_width[i] = self.column_width[i].max(col.len());
        }
        self.rows.push(row);
    }
fn add_row ( & mut self , index : usize , p : ( String , String , String ) , density : & [ f64 ] , volume : f64 , distance : f64 ) { let mut row : Vec < String > = Vec :: with_capacity ( 6 + self . density_num ) ; row . push ( format ! ( " " index ) ) ; row . push ( p . 0 ) ; row . push ( p . 1 ) ; row . push ( p . 2 ) ; density . iter ( ) . for_each ( | d | row . push ( format ! ( " " d ) ) ) ; row . push ( format ! ( " " volume ) ) ; row . push ( format ! ( " " distance ) ) ; for ( i , col ) in row . iter ( ) . enumerate ( ) { self . column_width [ i ] = self . column_width [ i ] . max ( col . len ( ) ) ; } self . rows . push ( row ) ; }
Adds a row the table.
Adds a row the table .
&mut self
index
usize
p
(String, String, String)
density
&[f64]
volume
f64
distance
f64
&mut self
index
usize
p
(String, String, String)
density
&[f64]
volume
f64
distance
f64