1
1
mirror of https://github.com/theoludwig/billion_row_challenge.git synced 2024-12-08 00:45:46 +01:00

20 lines
559 B
Rust

use config::Config;
use error::RunError;
use std::fs;
use weather::WeatherStations;
pub mod config;
pub mod error;
pub mod weather;
pub fn run(config: &Config) -> Result<(), RunError> {
let file_content = fs::read_to_string(&config.input_file_path)?;
let mut lines: Vec<String> = file_content.lines().map(|line| line.to_string()).collect();
let mut weather_stations = WeatherStations::default();
for line in lines.iter_mut() {
weather_stations.add_measurement(line);
}
println!("{}", weather_stations.output());
Ok(())
}