async fn create_changeset(
        &mut self,
        endpoints: &HashSet<SocketAddr>,
    ) -> Vec<Change<SocketAddr, Endpoint>> {
        let mut changeset = Vec::new();

        let remove_set: HashSet<SocketAddr> = self
            .endpoints
            .difference(endpoints)
            .copied()
            .into_iter()
            .collect();

        let add_set: HashSet<SocketAddr> = endpoints
            .difference(&self.endpoints)
            .copied()
            .into_iter()
            .collect();

        changeset.extend(
            add_set
                .into_iter()
                .filter_map(|addr| self.build_endpoint(&addr).map(|endpoint| (addr, endpoint)))
                .map(|(addr, endpoint)| Change::Insert(addr, endpoint)),
        );

        changeset.extend(remove_set.into_iter().map(Change::Remove));

        changeset
    }
/// Construct a changeset and report the endpoint changes to tonic.
Construct a changeset and report the endpoint changes to tonic.
Construct a changeset and report the endpoint changes to tonic .
async fn create_changeset(
        &mut self,
        endpoints: &HashSet<SocketAddr>,
    ) -> Vec<Change<SocketAddr, Endpoint>> {
        let mut changeset = Vec::new();
        let remove_set: HashSet<SocketAddr> = self
            .endpoints
            .difference(endpoints)
            .copied()
            .into_iter()
            .collect();
        let add_set: HashSet<SocketAddr> = endpoints
            .difference(&self.endpoints)
            .copied()
            .into_iter()
            .collect();
        changeset.extend(
            add_set
                .into_iter()
                .filter_map(|addr| self.build_endpoint(&addr).map(|endpoint| (addr, endpoint)))
                .map(|(addr, endpoint)| Change::Insert(addr, endpoint)),
        );
        changeset.extend(remove_set.into_iter().map(Change::Remove));
        changeset
    }
async fn create_changeset ( & mut self , endpoints : & HashSet < SocketAddr > , ) -> Vec < Change < SocketAddr , Endpoint > > { let mut changeset = Vec :: new ( ) ; let remove_set : HashSet < SocketAddr > = self . endpoints . difference ( endpoints ) . copied ( ) . into_iter ( ) . collect ( ) ; let add_set : HashSet < SocketAddr > = endpoints . difference ( & self . endpoints ) . copied ( ) . into_iter ( ) . collect ( ) ; changeset . extend ( add_set . into_iter ( ) . filter_map ( | addr | self . build_endpoint ( & addr ) . map ( | endpoint | ( addr , endpoint ) ) ) . map ( | ( addr , endpoint ) | Change :: Insert ( addr , endpoint ) ) , ) ; changeset . extend ( remove_set . into_iter ( ) . map ( Change :: Remove ) ) ; changeset }
Construct a changeset and report the endpoint changes to tonic.
Construct a changeset and report the endpoint changes to tonic .
&mut self
endpoints
&HashSet<SocketAddr>