fn search_services(&mut self, at: DateTime<Local>) -> Vec<Service> {
        let midnight = at.date().and_hms(0, 0, 0);
        let mut results = Vec::new();
        for stop_time in self.arrival_stop_times.iter() {
            let trip_id = stop_time.trip_id.clone();
            if let Some(departure_time) = self.trip_ids.get(&trip_id) {
                let arrival_time = midnight + stop_time.arrival_time.duration();
                let departure_time = *departure_time;
                if arrival_time > departure_time {
                    if let Some(trip) = self.trips.get(&trip_id) {
                        if !self.services.is_empty() && !self.services.contains_key(&trip.service_id) {
                            continue;
                        }
                        if let Some(route) = self.routes.get(&trip.route_id) {
                            let stop_id = stop_time.stop_id.clone();
                            let stop = self.stops.get(&stop_id).unwrap();
                            let arrival_longitude = stop.stop_lon.clone();
                            let short_name = route.route_short_name.clone();
                            let long_name = route.route_long_name.clone();
                            let service = Service {
                                arrival_longitude,
                                departure_time,
                                arrival_time,
                                short_name,
                                long_name
                            };
                            results.push(service);
                        }
                    }
                }
            }
        }

        if self.debug {
            println!("");
        }
        results.sort_by(|a, b| a.departure_time.cmp(&b.departure_time));
        results
    }
// Filter trips based on remaining services and routes, that also connect
// origin with destination stop candidates.
Filter trips based on remaining services and routes, that also connect
origin with destination stop candidates.
Filter trips based on remaining services and routes that also connect origin with destination stop candidates .
fn search_services(&mut self, at: DateTime<Local>) -> Vec<Service> {
        let midnight = at.date().and_hms(0, 0, 0);
        let mut results = Vec::new();
        for stop_time in self.arrival_stop_times.iter() {
            let trip_id = stop_time.trip_id.clone();
            if let Some(departure_time) = self.trip_ids.get(&trip_id) {
                let arrival_time = midnight + stop_time.arrival_time.duration();
                let departure_time = *departure_time;
                if arrival_time > departure_time {
                    if let Some(trip) = self.trips.get(&trip_id) {
                        if !self.services.is_empty() && !self.services.contains_key(&trip.service_id) {
                            continue;
                        }
                        if let Some(route) = self.routes.get(&trip.route_id) {
                            let stop_id = stop_time.stop_id.clone();
                            let stop = self.stops.get(&stop_id).unwrap();
                            let arrival_longitude = stop.stop_lon.clone();
                            let short_name = route.route_short_name.clone();
                            let long_name = route.route_long_name.clone();
                            let service = Service {
                                arrival_longitude,
                                departure_time,
                                arrival_time,
                                short_name,
                                long_name
                            };
                            results.push(service);
                        }
                    }
                }
            }
        }
        if self.debug {
            println!("");
        }
        results.sort_by(|a, b| a.departure_time.cmp(&b.departure_time));
        results
    }
fn search_services ( & mut self , at : DateTime < Local > ) -> Vec < Service > { let midnight = at . date ( ) . and_hms ( 0 , 0 , 0 ) ; let mut results = Vec :: new ( ) ; for stop_time in self . arrival_stop_times . iter ( ) { let trip_id = stop_time . trip_id . clone ( ) ; if let Some ( departure_time ) = self . trip_ids . get ( & trip_id ) { let arrival_time = midnight + stop_time . arrival_time . duration ( ) ; let departure_time = * departure_time ; if arrival_time > departure_time { if let Some ( trip ) = self . trips . get ( & trip_id ) { if ! self . services . is_empty ( ) && ! self . services . contains_key ( & trip . service_id ) { continue ; } if let Some ( route ) = self . routes . get ( & trip . route_id ) { let stop_id = stop_time . stop_id . clone ( ) ; let stop = self . stops . get ( & stop_id ) . unwrap ( ) ; let arrival_longitude = stop . stop_lon . clone ( ) ; let short_name = route . route_short_name . clone ( ) ; let long_name = route . route_long_name . clone ( ) ; let service = Service { arrival_longitude , departure_time , arrival_time , short_name , long_name } ; results . push ( service ) ; } } } } } if self . debug { println ! ( " " ) ; } results . sort_by ( | a , b | a . departure_time . cmp ( & b . departure_time ) ) ; results }
Filter trips based on remaining services and routes, that also connect
origin with destination stop candidates.
Filter trips based on remaining services and routes that also connect origin with destination stop candidates .
&mut self
at
DateTime<Local>
&mut self
at
DateTime<Local>