pub fn construct(
        mut current: HashSet<AddressOrigin>,
        origins: Option<Vec<RouteOrigins>>,
        exceptions: &LocalExceptions,
        serial: Serial,
        extra_info: bool,
    ) -> (AddressOrigins, Self, Metrics) {
        let mut next = HashSet::new();
        let mut announce = HashSet::new();
        let mut metrics = Metrics::new();

        if let Some(origins) = origins {
            for item in origins {
                let mut tal_metrics = TalMetrics::new(item.tal.clone());
                for mut roa in item {
                    tal_metrics.roas += 1;
                    let info = OriginInfo::from_roa(&mut roa, extra_info);
                    for addr in roa.iter() {
                        tal_metrics.vrps += 1;
                        let addr = AddressOrigin::from_roa(
                            roa.as_id(), addr, info.clone()
                        );
                        if !exceptions.keep_origin(&addr) {
                            continue
                        }
                        if next.insert(addr.clone()) && !current.remove(&addr) {
                            let _ = announce.insert(addr);
                        }
                    }
                }
                metrics.push_tal(tal_metrics);
            }
        }
        for addr in exceptions.assertions() {
            // Exceptions could have changed, so let’s be thorough here.
            if next.insert(addr.clone()) && !current.remove(addr)  {
                announce.insert(addr.clone());
            }
        }
        let withdraw: Vec<_> = current.into_iter().collect();
        let announce: Vec<_> = announce.into_iter().collect();
        info!(
            "Diff with {} announced and {} withdrawn.",
            announce.len(), withdraw.len()
        );
        (next.into(), OriginsDiff { serial, announce, withdraw }, metrics)
    }
/// Constructs a diff.
///
/// The method takes the previous list of address origins as a set (so
/// that there are definitely no duplicates), a list of route origins
/// gained from validation, a list of local exceptions, and the serial
/// number of the current version.
///
/// It will create and return the new list of address origins from the
/// route origins and a origins diff between the new and old address
/// origins with the serial number of `serial` plus one.
Constructs a diff.
The method takes the previous list of address origins as a set (so
that there are definitely no duplicates), a list of route origins
gained from validation, a list of local exceptions, and the serial
number of the current version.

It will create and return the new list of address origins from the
route origins and a origins diff between the new and old address
origins with the serial number of `serial` plus one.
Constructs a diff . The method takes the previous list of address origins as a set ( so that there are definitely no duplicates ) a list of route origins gained from validation a list of local exceptions and the serial number of the current version . It will create and return the new list of address origins from the route origins and a origins diff between the new and old address origins with the serial number of ` serial ` plus one .
pub fn construct(
        mut current: HashSet<AddressOrigin>,
        origins: Option<Vec<RouteOrigins>>,
        exceptions: &LocalExceptions,
        serial: Serial,
        extra_info: bool,
    ) -> (AddressOrigins, Self, Metrics) {
        let mut next = HashSet::new();
        let mut announce = HashSet::new();
        let mut metrics = Metrics::new();
        if let Some(origins) = origins {
            for item in origins {
                let mut tal_metrics = TalMetrics::new(item.tal.clone());
                for mut roa in item {
                    tal_metrics.roas += 1;
                    let info = OriginInfo::from_roa(&mut roa, extra_info);
                    for addr in roa.iter() {
                        tal_metrics.vrps += 1;
                        let addr = AddressOrigin::from_roa(
                            roa.as_id(), addr, info.clone()
                        );
                        if !exceptions.keep_origin(&addr) {
                            continue
                        }
                        if next.insert(addr.clone()) && !current.remove(&addr) {
                            let _ = announce.insert(addr);
                        }
                    }
                }
                metrics.push_tal(tal_metrics);
            }
        }
        for addr in exceptions.assertions() {
            // Exceptions could have changed, so let’s be thorough here.
            if next.insert(addr.clone()) && !current.remove(addr)  {
                announce.insert(addr.clone());
            }
        }
        let withdraw: Vec<_> = current.into_iter().collect();
        let announce: Vec<_> = announce.into_iter().collect();
        info!(
            "Diff with {} announced and {} withdrawn.",
            announce.len(), withdraw.len()
        );
        (next.into(), OriginsDiff { serial, announce, withdraw }, metrics)
    }
pub fn construct ( mut current : HashSet < AddressOrigin > , origins : Option < Vec < RouteOrigins > > , exceptions : & LocalExceptions , serial : Serial , extra_info : bool , ) -> ( AddressOrigins , Self , Metrics ) { let mut next = HashSet :: new ( ) ; let mut announce = HashSet :: new ( ) ; let mut metrics = Metrics :: new ( ) ; if let Some ( origins ) = origins { for item in origins { let mut tal_metrics = TalMetrics :: new ( item . tal . clone ( ) ) ; for mut roa in item { tal_metrics . roas += 1 ; let info = OriginInfo :: from_roa ( & mut roa , extra_info ) ; for addr in roa . iter ( ) { tal_metrics . vrps += 1 ; let addr = AddressOrigin :: from_roa ( roa . as_id ( ) , addr , info . clone ( ) ) ; if ! exceptions . keep_origin ( & addr ) { continue } if next . insert ( addr . clone ( ) ) && ! current . remove ( & addr ) { let _ = announce . insert ( addr ) ; } } } metrics . push_tal ( tal_metrics ) ; } } for addr in exceptions . assertions ( ) { // Exceptions could have changed, so let’s be thorough here. if next . insert ( addr . clone ( ) ) && ! current . remove ( addr ) { announce . insert ( addr . clone ( ) ) ; } } let withdraw : Vec < _ > = current . into_iter ( ) . collect ( ) ; let announce : Vec < _ > = announce . into_iter ( ) . collect ( ) ; info ! ( " " announce len ( ) withdraw len ( ) ) ; ( next . into ( ) , OriginsDiff { serial , announce , withdraw } , metrics ) }
Constructs a diff.
Constructs a diff .
current
HashSet<AddressOrigin>
origins
Option<Vec<RouteOrigins>>
exceptions
&LocalExceptions
serial
Serial
extra_info
bool
current
HashSet<AddressOrigin>
origins
Option<Vec<RouteOrigins>>
exceptions
&LocalExceptions
serial
Serial
extra_info
bool