pub fn both_finished_trips(
        &self,
        now: Time,
        before: &Analytics,
    ) -> Vec<(Duration, Duration, TripMode)> {
        let mut a = BTreeMap::new();
        for (t, id, maybe_mode, dt) in &self.finished_trips {
            if *t > now {
                break;
            }
            if maybe_mode.is_some() {
                a.insert(*id, *dt);
            }
        }

        let mut results = Vec::new();
        for (t, id, maybe_mode, dt) in &before.finished_trips {
            if *t > now {
                break;
            }
            if let Some(mode) = maybe_mode {
                if let Some(dt1) = a.remove(id) {
                    results.push((*dt, dt1, *mode));
                }
            }
        }
        results
    }
// Returns pairs of trip times for finished trips in both worlds. (before, after, mode)
Returns pairs of trip times for finished trips in both worlds. (before, after, mode)
Returns pairs of trip times for finished trips in both worlds . ( before after mode )
pub fn both_finished_trips(
        &self,
        now: Time,
        before: &Analytics,
    ) -> Vec<(Duration, Duration, TripMode)> {
        let mut a = BTreeMap::new();
        for (t, id, maybe_mode, dt) in &self.finished_trips {
            if *t > now {
                break;
            }
            if maybe_mode.is_some() {
                a.insert(*id, *dt);
            }
        }
        let mut results = Vec::new();
        for (t, id, maybe_mode, dt) in &before.finished_trips {
            if *t > now {
                break;
            }
            if let Some(mode) = maybe_mode {
                if let Some(dt1) = a.remove(id) {
                    results.push((*dt, dt1, *mode));
                }
            }
        }
        results
    }
pub fn both_finished_trips ( & self , now : Time , before : & Analytics , ) -> Vec < ( Duration , Duration , TripMode ) > { let mut a = BTreeMap :: new ( ) ; for ( t , id , maybe_mode , dt ) in & self . finished_trips { if * t > now { break ; } if maybe_mode . is_some ( ) { a . insert ( * id , * dt ) ; } } let mut results = Vec :: new ( ) ; for ( t , id , maybe_mode , dt ) in & before . finished_trips { if * t > now { break ; } if let Some ( mode ) = maybe_mode { if let Some ( dt1 ) = a . remove ( id ) { results . push ( ( * dt , dt1 , * mode ) ) ; } } } results }
Returns pairs of trip times for finished trips in both worlds.
Returns pairs of trip times for finished trips in both worlds .
&self
now
Time
before
&Analytics