/// Download market data for all of a region's structures
Download market data for all of a region's structures
Download market data for all of a region ' s structures
fn download_region_structures(region_id: RegionID,
                              client: esi::Client,
                              uni: universe::Universe)
                              -> thread::JoinHandle<Result<store::TaggedOrderVec>> {
    thread::spawn(move || {
        let structure_id_option = uni.get_public_structures_in_region(region_id);
        let mut orders: store::TaggedOrderVec = Vec::new();
        if let Some(structure_ids) = structure_id_option {
            let mut structure_handles: Vec<thread::JoinHandle<Result<store::TaggedOrderVec>>> =
                Vec::new();
            for structure in structure_ids {
                let handle = download_structure(structure, client.clone(), uni.clone());
                structure_handles.push(handle);
            }
            // Collect results
            for handle in structure_handles {
                // Unpack thread panic
                let thread_result = handle.join().unwrap();
                // Unpack thread result
                let mut structure_orders = thread_result?;
                orders.append(&mut structure_orders);
            }
        }
        Ok(orders)
    })
}
fn download_region_structures ( region_id : RegionID , client : esi :: Client , uni : universe :: Universe ) -> thread :: JoinHandle < Result < store :: TaggedOrderVec > > { thread :: spawn ( move | | { let structure_id_option = uni . get_public_structures_in_region ( region_id ) ; let mut orders : store :: TaggedOrderVec = Vec :: new ( ) ; if let Some ( structure_ids ) = structure_id_option { let mut structure_handles : Vec < thread :: JoinHandle < Result < store :: TaggedOrderVec > > > = Vec :: new ( ) ; for structure in structure_ids { let handle = download_structure ( structure , client . clone ( ) , uni . clone ( ) ) ; structure_handles . push ( handle ) ; } // Collect results for handle in structure_handles { // Unpack thread panic let thread_result = handle . join ( ) . unwrap ( ) ; // Unpack thread result let mut structure_orders = thread_result ? ; orders . append ( & mut structure_orders ) ; } } Ok ( orders ) } ) }
Download market data for all of a region's structures
Download market data for all of a region ' s structures
region_id
RegionID
client
esi::Client
uni
universe::Universe