title: How to push data from a csv::StringRecord to each column vector in a struct?
body: <p>How to implement the <code>push(&amp;self, row: &amp;csv::StringRecord)</code> trait below?</p>
  
  <p>The input is a reference to a <code>csv::StringRecord</code> from the <code>rust-csv</code> library. The idea is to append each column onto it's vector.</p>
  
  <pre><code>extern crate csv;
  
  #[derive(Debug)]
  struct DataFrame {
      header: csv::StringRecord,
      name: Vec&lt;String&gt;,
      datetime: Vec&lt;String&gt;,
      speed: Vec&lt;f32&gt;,
  }
  
  impl DataFrame {
      fn new() -&gt; DataFrame {
          DataFrame {
              header: csv::StringRecord::new(),
              name: Vec::new(),
              datetime: Vec::new(),
              speed: Vec::new(),
          }
      }
  
      fn read_csv(filepath: &amp;str, has_headers: bool) -&gt; DataFrame {
          // Open file
          let file = std::fs::File::open(filepath).unwrap();
          let mut rdr = csv::ReaderBuilder::new()
              .has_headers(has_headers)
              .from_reader(file);
  
          // Add values to struct
          let mut empty_dataframe = DataFrame::new();
          empty_dataframe.header = rdr.headers().unwrap().clone();
          for result in rdr.records() {
              empty_dataframe.push(&amp;result.unwrap());
          }
          empty_dataframe
      }
  
      fn push(&amp;self, row: &amp;csv::StringRecord) {
          println!("{:?}", row);
          //self.name.push(name);
          //self.datetime.push(datetime);
          //self.speed.push(speed);
      }
  }
  
  
  fn main() {
      let data = DataFrame::read_csv("src/data.csv", true);
      println!("{:?}", data);
  }
  </code></pre>
  
  <p><code>Cargo.toml</code> has the following dependency (version is important as <code>ReaderBuilder</code> is only available after version 1.</p>
  
  <pre><code>[dependencies]
  csv = "1.0.0-beta.5"
  </code></pre>
  
  <p><code>data.csv</code> is in the following format:</p>
  
  <pre><code>&gt;&gt;&gt; head src/data.csv
  Name,DateTime,Speed
  Tom,2016-01-04 09:30:00.038279090,102.44
  Tom,2016-01-04 09:30:00.038279090,102.44
  </code></pre>