fn search_calendar(&mut self, at: DateTime<Local>) {
        let date = at.date().naive_local();

        let mut n = 0;
        for result in self.gtfs.calendar() {
            n += 1;
            if let Ok(entry) = result {
                let service_id = entry.service_id;
                if self.service_ids.contains_key(&service_id) {
                    let is_running = match date.weekday() {
                        Weekday::Mon => entry.monday,
                        Weekday::Tue => entry.tuesday,
                        Weekday::Wed => entry.wednesday,
                        Weekday::Thu => entry.thursday,
                        Weekday::Fri => entry.friday,
                        Weekday::Sat => entry.saturday,
                        Weekday::Sun => entry.sunday
                    };
                    if !is_running {
                        continue;
                    }
                    if entry.start_date <= date && date <= entry.end_date {
                        self.services.insert(service_id, true);
                    }
                }
            }
        }
        if self.debug {
            println!("{}: loaded {} services ({} retained)", "Debug".cyan(), n, self.services.len());
        }
    }
// Get services from their ids that are running on the given date
Get services from their ids that are running on the given date
Get services from their ids that are running on the given date
fn search_calendar(&mut self, at: DateTime<Local>) {
        let date = at.date().naive_local();
        let mut n = 0;
        for result in self.gtfs.calendar() {
            n += 1;
            if let Ok(entry) = result {
                let service_id = entry.service_id;
                if self.service_ids.contains_key(&service_id) {
                    let is_running = match date.weekday() {
                        Weekday::Mon => entry.monday,
                        Weekday::Tue => entry.tuesday,
                        Weekday::Wed => entry.wednesday,
                        Weekday::Thu => entry.thursday,
                        Weekday::Fri => entry.friday,
                        Weekday::Sat => entry.saturday,
                        Weekday::Sun => entry.sunday
                    };
                    if !is_running {
                        continue;
                    }
                    if entry.start_date <= date && date <= entry.end_date {
                        self.services.insert(service_id, true);
                    }
                }
            }
        }
        if self.debug {
            println!("{}: loaded {} services ({} retained)", "Debug".cyan(), n, self.services.len());
        }
    }
fn search_calendar ( & mut self , at : DateTime < Local > ) { let date = at . date ( ) . naive_local ( ) ; let mut n = 0 ; for result in self . gtfs . calendar ( ) { n += 1 ; if let Ok ( entry ) = result { let service_id = entry . service_id ; if self . service_ids . contains_key ( & service_id ) { let is_running = match date . weekday ( ) { Weekday :: Mon => entry . monday , Weekday :: Tue => entry . tuesday , Weekday :: Wed => entry . wednesday , Weekday :: Thu => entry . thursday , Weekday :: Fri => entry . friday , Weekday :: Sat => entry . saturday , Weekday :: Sun => entry . sunday } ; if ! is_running { continue ; } if entry . start_date <= date && date <= entry . end_date { self . services . insert ( service_id , true ) ; } } } } if self . debug { println ! ( " " " " cyan ( ) n self services len ( ) ) ; } }
Get services from their ids that are running on the given date
Get services from their ids that are running on the given date
&mut self
at
DateTime<Local>
&mut self
at
DateTime<Local>