pub fn read_zones_from_file(
    input: impl AsRef<Path>,
) -> Result<Box<dyn std::iter::Iterator<Item = Result<Zone, Error>> + Sync + Send>, Error> {
    let format = OutputFormat::from_filename(input.as_ref())?;
    let f = std::fs::File::open(input.as_ref())?;
    let f = std::io::BufReader::new(f);
    match format {
        OutputFormat::JsonGz | OutputFormat::Json => {
            let cosmo = load_cosmogony(f, format)?;
            Ok(Box::new(cosmo.zones.into_iter().map(Ok)))
        }
        OutputFormat::JsonStream => Ok(Box::new(read_zones(f))),
        OutputFormat::JsonStreamGz => {
            let r = flate2::bufread::GzDecoder::new(f);
            let r = std::io::BufReader::new(r);
            Ok(Box::new(read_zones(r)))
        }
    }
}
/// Return an iterator on the zones
/// if the input file is a jsonstream, the zones are streamed
/// if the input file is a json, the whole cosmogony is loaded
Return an iterator on the zones
if the input file is a jsonstream, the zones are streamed
if the input file is a json, the whole cosmogony is loaded
Return an iterator on the zones if the input file is a jsonstream the zones are streamed if the input file is a json the whole cosmogony is loaded
pub fn read_zones_from_file(
    input: impl AsRef<Path>,
) -> Result<Box<dyn std::iter::Iterator<Item = Result<Zone, Error>> + Sync + Send>, Error> {
    let format = OutputFormat::from_filename(input.as_ref())?;
    let f = std::fs::File::open(input.as_ref())?;
    let f = std::io::BufReader::new(f);
    match format {
        OutputFormat::JsonGz | OutputFormat::Json => {
            let cosmo = load_cosmogony(f, format)?;
            Ok(Box::new(cosmo.zones.into_iter().map(Ok)))
        }
        OutputFormat::JsonStream => Ok(Box::new(read_zones(f))),
        OutputFormat::JsonStreamGz => {
            let r = flate2::bufread::GzDecoder::new(f);
            let r = std::io::BufReader::new(r);
            Ok(Box::new(read_zones(r)))
        }
    }
}
pub fn read_zones_from_file ( input : impl AsRef < Path > , ) -> Result < Box < dyn std :: iter :: Iterator < Item = Result < Zone , Error > > + Sync + Send > , Error > { let format = OutputFormat :: from_filename ( input . as_ref ( ) ) ? ; let f = std :: fs :: File :: open ( input . as_ref ( ) ) ? ; let f = std :: io :: BufReader :: new ( f ) ; match format { OutputFormat :: JsonGz | OutputFormat :: Json => { let cosmo = load_cosmogony ( f , format ) ? ; Ok ( Box :: new ( cosmo . zones . into_iter ( ) . map ( Ok ) ) ) } OutputFormat :: JsonStream => Ok ( Box :: new ( read_zones ( f ) ) ) , OutputFormat :: JsonStreamGz => { let r = flate2 :: bufread :: GzDecoder :: new ( f ) ; let r = std :: io :: BufReader :: new ( r ) ; Ok ( Box :: new ( read_zones ( r ) ) ) } } }
Return an iterator on the zones
if the input file is a jsonstream, the zones are streamed
if the input file is a json, the whole cosmogony is loaded
Return an iterator on the zones if the input file is a jsonstream the zones are streamed if the input file is a json the whole cosmogony is loaded
input
impl AsRef<Path>