pub(crate) fn diff(&self, other: &Self) -> Diff {
        let mut diff: BTreeMap<String, _> = BTreeMap::new();
        let self_keys: BTreeSet<_> = self.0.keys().collect();
        let other_keys: BTreeSet<_> = other.0.keys().collect();
        for removed in self_keys.difference(&other_keys) {
            diff.insert((*removed).clone(), ServiceDiff::Stop(self.0[*removed]));
        }
        for added in other_keys.difference(&self_keys) {
            diff.insert((*added).clone(), ServiceDiff::Start(other.0[*added]));
        }
        for maybe_changed in self_keys.intersection(&other_keys) {
            let old = self.0[*maybe_changed];
            let new = other.0[*maybe_changed];
            if old != new {
                diff.insert(
                    (*maybe_changed).clone(),
                    ServiceDiff::Swap {
                        current: old,
                        next: new,
                    },
                );
            }
        }

        Diff(diff)
    }
/// Compute a set of service modifications that must be done in order to
/// make the `self` set match the desired `other` set.
Compute a set of service modifications that must be done in order to
make the `self` set match the desired `other` set.
Compute a set of service modifications that must be done in order to make the ` self ` set match the desired ` other ` set .
pub(crate) fn diff(&self, other: &Self) -> Diff {
        let mut diff: BTreeMap<String, _> = BTreeMap::new();
        let self_keys: BTreeSet<_> = self.0.keys().collect();
        let other_keys: BTreeSet<_> = other.0.keys().collect();
        for removed in self_keys.difference(&other_keys) {
            diff.insert((*removed).clone(), ServiceDiff::Stop(self.0[*removed]));
        }
        for added in other_keys.difference(&self_keys) {
            diff.insert((*added).clone(), ServiceDiff::Start(other.0[*added]));
        }
        for maybe_changed in self_keys.intersection(&other_keys) {
            let old = self.0[*maybe_changed];
            let new = other.0[*maybe_changed];
            if old != new {
                diff.insert(
                    (*maybe_changed).clone(),
                    ServiceDiff::Swap {
                        current: old,
                        next: new,
                    },
                );
            }
        }
        Diff(diff)
    }
pub ( crate ) fn diff ( & self , other : & Self ) -> Diff { let mut diff : BTreeMap < String , _ > = BTreeMap :: new ( ) ; let self_keys : BTreeSet < _ > = self . 0 . keys ( ) . collect ( ) ; let other_keys : BTreeSet < _ > = other . 0 . keys ( ) . collect ( ) ; for removed in self_keys . difference ( & other_keys ) { diff . insert ( ( * removed ) . clone ( ) , ServiceDiff :: Stop ( self . 0 [ * removed ] ) ) ; } for added in other_keys . difference ( & self_keys ) { diff . insert ( ( * added ) . clone ( ) , ServiceDiff :: Start ( other . 0 [ * added ] ) ) ; } for maybe_changed in self_keys . intersection ( & other_keys ) { let old = self . 0 [ * maybe_changed ] ; let new = other . 0 [ * maybe_changed ] ; if old != new { diff . insert ( ( * maybe_changed ) . clone ( ) , ServiceDiff :: Swap { current : old , next : new , } , ) ; } } Diff ( diff ) }
Compute a set of service modifications that must be done in order to
make the `self` set match the desired `other` set.
Compute a set of service modifications that must be done in order to make the ` self ` set match the desired ` other ` set .
&self
other
&Self
&self
other
&Self