fn load_cosmogony(reader: impl std::io::BufRead, format: OutputFormat) -> Result<Cosmogony, Error> {
    match format {
        OutputFormat::JsonGz => {
            let r = flate2::read::GzDecoder::new(reader);
            serde_json::from_reader(r).map_err(|e| failure::err_msg(e.to_string()))
        }
        OutputFormat::Json => {
            serde_json::from_reader(reader).map_err(|e| failure::err_msg(e.to_string()))
        }
        OutputFormat::JsonStream => from_json_stream(reader),
        OutputFormat::JsonStreamGz => {
            let r = flate2::bufread::GzDecoder::new(reader);
            let r = std::io::BufReader::new(r);
            from_json_stream(r)
        }
    }
}
// Load a cosmogony from a reader and a file_format
Load a cosmogony from a reader and a file_format
Load a cosmogony from a reader and a file_format
fn load_cosmogony(reader: impl std::io::BufRead, format: OutputFormat) -> Result<Cosmogony, Error> {
    match format {
        OutputFormat::JsonGz => {
            let r = flate2::read::GzDecoder::new(reader);
            serde_json::from_reader(r).map_err(|e| failure::err_msg(e.to_string()))
        }
        OutputFormat::Json => {
            serde_json::from_reader(reader).map_err(|e| failure::err_msg(e.to_string()))
        }
        OutputFormat::JsonStream => from_json_stream(reader),
        OutputFormat::JsonStreamGz => {
            let r = flate2::bufread::GzDecoder::new(reader);
            let r = std::io::BufReader::new(r);
            from_json_stream(r)
        }
    }
}
fn load_cosmogony ( reader : impl std :: io :: BufRead , format : OutputFormat ) -> Result < Cosmogony , Error > { match format { OutputFormat :: JsonGz => { let r = flate2 :: read :: GzDecoder :: new ( reader ) ; serde_json :: from_reader ( r ) . map_err ( | e | failure :: err_msg ( e . to_string ( ) ) ) } OutputFormat :: Json => { serde_json :: from_reader ( reader ) . map_err ( | e | failure :: err_msg ( e . to_string ( ) ) ) } OutputFormat :: JsonStream => from_json_stream ( reader ) , OutputFormat :: JsonStreamGz => { let r = flate2 :: bufread :: GzDecoder :: new ( reader ) ; let r = std :: io :: BufReader :: new ( r ) ; from_json_stream ( r ) } } }
Load a cosmogony from a reader and a file_format
Load a cosmogony from a reader and a file_format
reader
impl std::io::BufRead
format
OutputFormat