pub fn summaries<'a, 'b>(
        &'a mut self,
        name: InternedString,
        req: &'b OptVersionReq,
        load: &mut dyn RegistryData,
    ) -> CargoResult<impl Iterator<Item = &'a IndexSummary> + 'b>
    where
        'a: 'b,
    {
        let source_id = self.source_id;
        let config = self.config;
        let namespaced_features = self.config.cli_unstable().namespaced_features;
        let weak_dep_features = self.config.cli_unstable().weak_dep_features;

        // First up actually parse what summaries we have available. If Cargo
        // has run previously this will parse a Cargo-specific cache file rather
        // than the registry itself. In effect this is intended to be a quite
        // cheap operation.
        let summaries = self.load_summaries(name, load)?;

        // Iterate over our summaries, extract all relevant ones which match our
        // version requirement, and then parse all corresponding rows in the
        // registry. As a reminder this `summaries` method is called for each
        // entry in a lock file on every build, so we want to absolutely
        // minimize the amount of work being done here and parse as little as
        // necessary.
        let raw_data = &summaries.raw_data;
        let max_version = if namespaced_features || weak_dep_features {
            INDEX_V_MAX
        } else {
            1
        };
        Ok(summaries
            .versions
            .iter_mut()
            .filter_map(move |(k, v)| if req.matches(k) { Some(v) } else { None })
            .filter_map(
                move |maybe| match maybe.parse(config, raw_data, source_id) {
                    Ok(summary) => Some(summary),
                    Err(e) => {
                        info!("failed to parse `{}` registry package: {}", name, e);
                        None
                    }
                },
            )
            .filter(move |is| {
                if is.v > max_version {
                    debug!(
                        "unsupported schema version {} ({} {})",
                        is.v,
                        is.summary.name(),
                        is.summary.version()
                    );
                    false
                } else {
                    true
                }
            })
            .filter(move |is| {
                is.summary
                    .unstable_gate(namespaced_features, weak_dep_features)
                    .is_ok()
            }))
    }
/// Load a list of summaries for `name` package in this registry which
/// match `req`
///
/// This function will semantically parse the on-disk index, match all
/// versions, and then return an iterator over all summaries which matched.
/// Internally there's quite a few layer of caching to amortize this cost
/// though since this method is called quite a lot on null builds in Cargo.
Load a list of summaries for `name` package in this registry which
match `req`

This function will semantically parse the on-disk index, match all
versions, and then return an iterator over all summaries which matched.
Internally there's quite a few layer of caching to amortize this cost
though since this method is called quite a lot on null builds in Cargo.
Load a list of summaries for ` name ` package in this registry which match ` req ` This function will semantically parse the on - disk index match all versions and then return an iterator over all summaries which matched . Internally there ' s quite a few layer of caching to amortize this cost though since this method is called quite a lot on null builds in Cargo .
pub fn summaries<'a, 'b>(
        &'a mut self,
        name: InternedString,
        req: &'b OptVersionReq,
        load: &mut dyn RegistryData,
    ) -> CargoResult<impl Iterator<Item = &'a IndexSummary> + 'b>
    where
        'a: 'b,
    {
        let source_id = self.source_id;
        let config = self.config;
        let namespaced_features = self.config.cli_unstable().namespaced_features;
        let weak_dep_features = self.config.cli_unstable().weak_dep_features;
        // First up actually parse what summaries we have available. If Cargo
        // has run previously this will parse a Cargo-specific cache file rather
        // than the registry itself. In effect this is intended to be a quite
        // cheap operation.
        let summaries = self.load_summaries(name, load)?;
        // Iterate over our summaries, extract all relevant ones which match our
        // version requirement, and then parse all corresponding rows in the
        // registry. As a reminder this `summaries` method is called for each
        // entry in a lock file on every build, so we want to absolutely
        // minimize the amount of work being done here and parse as little as
        // necessary.
        let raw_data = &summaries.raw_data;
        let max_version = if namespaced_features || weak_dep_features {
            INDEX_V_MAX
        } else {
            1
        };
        Ok(summaries
            .versions
            .iter_mut()
            .filter_map(move |(k, v)| if req.matches(k) { Some(v) } else { None })
            .filter_map(
                move |maybe| match maybe.parse(config, raw_data, source_id) {
                    Ok(summary) => Some(summary),
                    Err(e) => {
                        info!("failed to parse `{}` registry package: {}", name, e);
                        None
                    }
                },
            )
            .filter(move |is| {
                if is.v > max_version {
                    debug!(
                        "unsupported schema version {} ({} {})",
                        is.v,
                        is.summary.name(),
                        is.summary.version()
                    );
                    false
                } else {
                    true
                }
            })
            .filter(move |is| {
                is.summary
                    .unstable_gate(namespaced_features, weak_dep_features)
                    .is_ok()
            }))
    }
pub fn summaries < ' a , ' b > ( & ' a mut self , name : InternedString , req : & ' b OptVersionReq , load : & mut dyn RegistryData , ) -> CargoResult < impl Iterator < Item = & ' a IndexSummary > + ' b > where ' a : ' b , { let source_id = self . source_id ; let config = self . config ; let namespaced_features = self . config . cli_unstable ( ) . namespaced_features ; let weak_dep_features = self . config . cli_unstable ( ) . weak_dep_features ; // First up actually parse what summaries we have available. If Cargo // has run previously this will parse a Cargo-specific cache file rather // than the registry itself. In effect this is intended to be a quite // cheap operation. let summaries = self . load_summaries ( name , load ) ? ; // Iterate over our summaries, extract all relevant ones which match our // version requirement, and then parse all corresponding rows in the // registry. As a reminder this `summaries` method is called for each // entry in a lock file on every build, so we want to absolutely // minimize the amount of work being done here and parse as little as // necessary. let raw_data = & summaries . raw_data ; let max_version = if namespaced_features || weak_dep_features { INDEX_V_MAX } else { 1 } ; Ok ( summaries . versions . iter_mut ( ) . filter_map ( move | ( k , v ) | if req . matches ( k ) { Some ( v ) } else { None } ) . filter_map ( move | maybe | match maybe . parse ( config , raw_data , source_id ) { Ok ( summary ) => Some ( summary ) , Err ( e ) => { info ! ( " " name e ) ; None } } , ) . filter ( move | is | { if is . v > max_version { debug ! ( " " is v is summary name ( ) is summary version ( ) ) ; false } else { true } } ) . filter ( move | is | { is . summary . unstable_gate ( namespaced_features , weak_dep_features ) . is_ok ( ) } ) ) }
Load a list of summaries for `name` package in this registry which
match `req`
Load a list of summaries for ` name ` package in this registry which match ` req `
&'a mut self
name
InternedString
req
&'b OptVersionReq
load
&mut dyn RegistryData
&'a mut self
name
InternedString
req
&'b OptVersionReq
load
&mut dyn RegistryData